In Windows versions of R/RStudio when refering to filename paths, you
need to either use two "\\" characters instead of one, OR use the
reverse slash "/" as used in Linux/Unix. It's an unfortunate conflict
between R and Windows in that a single \ character by itself is
treated as an esc
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) {
>
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 1
Thanks, Jeff. The reason I am creating the function is I have to read some
more datasets too. I have also modified the code as per your suggestion. I
have to send the dataset name in parameter in subsequent calls.
fsasdat<-function(dsn) {
pat="C:\\Users\\Anbu\\Desktop\\sas\\"
str1=str_c(pat,ds
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 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:\U
Simplest suggestion is to forget turning this into a function. Alternatively,
remove the "allmetrx=" from the last line of your function, as the assignment
suppresses automatic printing of the result. However, it may already be
working... you could assign the result of the function call outside
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")
7 matches
Mail list logo