Hello. I had previously used University Edition to convert SAS files to Stata files, and I used the following code:
proc export data=home/u43327634/NHANES/17_18/DEMO_J.XPT
file='C:\Users\zachc\Desktop\test.dta'
dbms=stata
replace;
run;
However, my institution recently switched over to SAS OnDemand for Academics, and now that code doesn't work. It gives the following error message:
In order to use the .xpt file, use a XPORT library:
libname xpt xport 'home/u43327634/NHANES/17_18/DEMO_J.XPT';
You can then treat library XPT like any other SAS library in your code; for instance, it will appear ion the Libraries section of SAS Studio.
The DATA= option of the PROC EXPORT statement requires a dataset designation, comprised of (optional) a library name with a dot and the name of the dataset.
If you have an xpt file, you can define a LIBNAME for that.
Your Data= does not expect an xpt file. It expects a libname.datasetname, such as work.something.
Your XPT file should have been copied to a library for use.
I suspect that your code didn't work with an XPT file before either, or if it did the file name was enclosed in quotes.
Thank you for your reply. I followed the directions for how to set up a libname (https://support.sas.com/software/products/university-edition/faq/SAS_libname.htm), but now I'm getting another error message when I run the following:
libname DEMO_J '/home/u43327634/NHANES/17_18/';
proc export data=DEMO_J
file='C:\Users\zachc\Desktop\test.dta'
dbms=stata
replace;
run;
Error Message: ERROR: Insufficient authorization to access /pbr/biconfig/940/Lev1/SASApp/C:\Users\zachc\Desktop.dta.
When you say that my XPT file should have been copied to a library for use, I'm not clear on what you mean. My XPT file is located in my SAS Studio file structure. Any more suggestions would be most welcome.
In SAS on Demand, you CANNOT access your desktop drive. CANNOT. Please study the "Frequently Asked Questions":
You have to use a path in your home directory, same as you did for the LIBNAME, and then download the file with SAS Studio.
In order to use the .xpt file, use a XPORT library:
libname xpt xport 'home/u43327634/NHANES/17_18/DEMO_J.XPT';
You can then treat library XPT like any other SAS library in your code; for instance, it will appear ion the Libraries section of SAS Studio.
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.