BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
asuman
Obsidian | Level 7

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

3 REPLIES 3
Reeza
Super User

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.

 

 


 

 

asuman
Obsidian | Level 7

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

Reeza
Super User

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.


 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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