DATA Step, Macro, Functions and more

how to write mac path in sas studio for infile

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

how to write mac path in sas studio for infile

hello everyone,

 

I am using mac and  have stored my file on desktop under folder sasuniversityedition/myfolders and the myfolders is shared with my vmware.I wrote this code  but still i am not able to run it correctly.I am getting 66 lines of error for this short code and the log windows is showing �g��M 1338 these things.

data demo;
infile "/folders/myfolders/mydata.docx";
input gender $ age height weight;
run;
title 'check infile on mac';
proc print data=demo;
run;

Any help will be appreciated.

 

 


Accepted Solutions
Solution
‎07-16-2017 02:18 PM
Super User
Posts: 19,770

Re: how to write mac path in sas studio for infile

[ Edited ]

You cannot read a docx file, it's not a text file. If the data is text, save it as a txt file and then work with that file.

DOCX is actually a zipped XML file that has a lot of components in it. Your path is specified correctly and if you're getting errors that don't say file not found it's finding the file. It's just not a file that can be worked with easily. I wouldn't recommend starting to learn SAS by doing this type of exercise (figuring out how to read a docx file).

 


asuman wrote:

hello everyone,

 

I am using mac and  have stored my file on desktop under folder sasuniversityedition/myfolders and the myfolders is shared with my vmware.I wrote this code  but still i am not able to run it correctly.I am getting 66 lines of error for this short code and the log windows is showing �g��M 1338 these things.

data demo;
infile "/folders/myfolders/mydata.docx";
input gender $ age height weight;
run;
title 'check infile on mac';
proc print data=demo;
run;

Any help will be appreciated.

 

 


 

 

View solution in original post


All Replies
Solution
‎07-16-2017 02:18 PM
Super User
Posts: 19,770

Re: how to write mac path in sas studio for infile

[ Edited ]

You cannot read a docx file, it's not a text file. If the data is text, save it as a txt file and then work with that file.

DOCX is actually a zipped XML file that has a lot of components in it. Your path is specified correctly and if you're getting errors that don't say file not found it's finding the file. It's just not a file that can be worked with easily. I wouldn't recommend starting to learn SAS by doing this type of exercise (figuring out how to read a docx file).

 


asuman wrote:

hello everyone,

 

I am using mac and  have stored my file on desktop under folder sasuniversityedition/myfolders and the myfolders is shared with my vmware.I wrote this code  but still i am not able to run it correctly.I am getting 66 lines of error for this short code and the log windows is showing �g��M 1338 these things.

data demo;
infile "/folders/myfolders/mydata.docx";
input gender $ age height weight;
run;
title 'check infile on mac';
proc print data=demo;
run;

Any help will be appreciated.

 

 


 

 

Occasional Contributor
Posts: 5

Re: how to write mac path in sas studio for infile

Thanks its working.Is there any other file extension which i should know that is not working with sas.

Super User
Posts: 19,770

Re: how to write mac path in sas studio for infile

That's a long list and it depends on what you're trying to do. It's not a matter of extension it's a matter of right tool and process.

 

For example, SAS TextMiner can read and process Word and PDF files, but they're unstructured data and you can't read those in a data step. They're proprietary formats that are locked down. Most of the common data sources will work, ie text files, database connections, XLSX files. 

 


asuman wrote:

Thanks its working.Is there any other file extension which i should know that is not working with sas.


 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 264 views
  • 0 likes
  • 2 in conversation