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

I am currently using SAS 9.4 and I haven't been able to open or convert my XPT files in SAS. I have tried the following sample code from another post on the forum regarding converting XPT to SAS:

 

libname xptfile xport 'C:\XPT Datasets';

libname sasfile 'C:\SAS Datasets';

 

data sasfile.ca125cec;

   set xptfile.ca125cec;

run;

 

I attached a screenshot of my editor and the error log I received when I input the file location. I had my brother who is a computer science major try to help me and we got nowhere. Basically, I would like to be able to open the data files in the explorer on the left pane of the screenshot attached. Any help is appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
6 REPLIES 6
ballardw
Super User

Usually instead of creating screen shots and placing them into separate documents it is much easier to 1) copy text from the editor or log, in the case of log entries the code and the messages, and then 2) paste into a code box opened using the forum's {I} or "running man" icons. Then we can highlight or copy and paste bits that need to be addressed easier.

 

Since your posted PDF has a LIBNAME SASFILE that is about 60 characters long, mixes \ and / and has spaces between the slashes and the folder names I am not surprised that you get a "Library SASFILE does not exist". Since you also use the same very likely to be very incorrect path for the source xport that is likely why you are getting file does not exist errors.

ekperatoner
Calcite | Level 5

Thank you for your prompt reply. I see your point; is there a source path that you would recommend I implement or is there a better way to save the file? I am a pre-med student with zero coding experience so I apologize if I am not making sense. 

ChrisNZ
Tourmaline | Level 20

Copy the exact path from the Windows Explorer window.

It looks like this in W7:

Capture.PNG

 

Tom
Super User Tom
Super User

All of those strange characters make it look like you copied a path from a program that expects to use backslash to "escape" special characters. Have you been using R perhaps?

 

If you can see the file using Windows Explorer then use shift-Right Mouse Button to click on the filename to get a pop-up menu that includes Copy as Path.  Select that and it will put the full name of the file into the paste buffer so that you can paste it into your program.  That should give you the path inside of double quotes .

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 815 views
  • 2 likes
  • 4 in conversation