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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1046 views
  • 2 likes
  • 4 in conversation