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!
Copy the exact path from the Windows Explorer window.
It looks like this in W7:
SAS complains about non-existing paths. Show us that they exist.
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.
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.
Copy the exact path from the Windows Explorer window.
It looks like this in W7:
Ok I will try that, thank you!
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.