What happens if you go to the import tool in RStudio? It should do your bidding, and, it produces code which you then can copy and paste.
el On 2020-12-24 19:31 , Anbu A wrote: > Hi Bill, > r"{C:\Users\Anbu\Desktop\sas\}" - This is the key and code below worked. > fsasdat<-function(dsn) { > pat=r"{C:\Users\Anbu\Desktop\sas\}" > str1=str_c(pat,dsn,".sas7bdat") > read_sas(str1) > #return(str1) > } > allmetrx=fsasdat("all") > str(allmetrx) > > Thank you. > > Anbu. > > > On Thu, Dec 24, 2020 at 12:12 PM Bill Dunlap <williamwdun...@gmail.com> > wrote: > >> The "\n" is probably not in the file name. Does omitting it from the call >> to str_c help? >> >> -Bill >> >> On Thu, Dec 24, 2020 at 6:20 AM Anbu A <rquestion2...@gmail.com> wrote: >> >>> Hi All, >>> I am a newbie. This is my first program. >>> I am trying to read SAS dataset from below path. I added escape "\" along >>> "\" found in path C:\Users\axyz\Desktop\sas\ but still not working. >>> >>> fsasdat<-function(dsn) { >>> pat="C:\\Users\\axyz\\Desktop\\sas\\" >>> str1=str_c(pat,dsn,".sas7bdat","\n") >>> allmetrx=read_sas(str1) >>> } >>> fsasdat("all") >>> >>> Please help me. >>> >>> Thanks, >>> AA. >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Dr. Eberhard W. Lisse \ / Obstetrician & Gynaecologist e...@lisse.na / * | Telephone: +264 81 124 6733 (cell) PO Box 8421 Bachbrecht \ / If this email is signed with GPG/PGP 10007, Namibia ;____/ Sect 20 of Act No. 4 of 2019 may apply ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.