Please, I need help exporting or saving a SAS dataset to a folder on my desktop.
I have tried the following codes but they did not work:
LIBNAME myperm "C:\temp\Merged\";
data myperm.Merged_data4;
set sashelp.Merged_data4;
run;
Libname Merged 'C:\Users\Jking.HEALTHCARE\Desktop\Apple\';
proc datasets library=work;
copy in=work out=Merged;
select Merged_data;
run;quit;
Thank you
I tried this and it worked.
LIBNAME myperm "C:\temp\Merged\";
data myperm.Merged_data4;
set Merged_data4;
run;
Based on your statement, I took out the "sashelp" and it worked.
Thank you so much for your assistance.
1.These 2 pieces of code do not even point to the same table.
2. "did not work" is too vague. Show us the whole log.
The above codes could not save the dataset to my desktop. I need a code that works and some explanation for it to help me understand how to use it.
Thank you.
Feel free not to take my comments into consideration.
When a senior user/helper here asks you to do something, you better do it; help us to help you. Otherwise it will be considered that you are not really interested in getting help.
So please post your complete log of the code that did not work as expected. Use the </> button to post the log. DO NOT post log or code text into the main posting window, as this will destroy the formatting and replace certain elements with emoticons and the like. Use the "little running man" (next to </>) for posting code.
My sincere apologies. I did not see the portion of the message requesting for the log.
This is the log for the codes and the unedited codes below.
Thank you.
2769 LIBNAME myperm "C:\temp\Merged\"; -- 49 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. 2778 LIBNAME myperm "C:\temp\Merged\"; 2779 data myperm.Merged_data4; 2780 set sashelp.Merged_data4; 2781 run; 2782 Libname Merged 'C:\Users\Uokoro.HEALTHCARE\Desktop\Delirium\'; 2783 proc datasets library=work; 2784 copy in=work out=Merged; 2785 select Merged_data4; 2786 run;quit;
LIBNAME myperm "C:\temp\Merged\";
data myperm.Merged_data4;
set sashelp.Merged_data4;
run;
Libname Merged 'C:\Users\Uokoro.HEALTHCARE\Desktop\Delirium\';
proc datasets library=work;
copy in=work out=Merged;
select Merged_data4;
run;quit;
Could it be that this code is part of a macro definition?
You could also have unbalanced quotes further up in the code (after all, there were >2700 lines before the part you posted).
Start a new SAS session and run this code only:
LIBNAME myperm "C:\temp\Merged\";
data myperm.Merged_data4;
set sashelp.Merged_data4;
run;
and then post the log.
BTW: SASHELP is a read-only library supplied by SAS, with important views and common example datasets. I sincerely doubt that you could create a dataset like MERGED_DATA4 there.
The code is not part of a macro definition. The Merged_data4 is a data set resulting from the merging of 3 other data sets and creation of additional variables from existing ones. That is why I have 2700 lines posted.I also ran some parts of the codes repeatedly. As a result of the above reasons, I cannot run the code alone. The "sashelp" was not part of my code prior to this point. I saw it online and thought it could help me save the dataset.
Thank you.
I asked about the macro definition because of this:
2778 LIBNAME myperm "C:\temp\Merged\";
2779 data myperm.Merged_data4;
2780 set sashelp.Merged_data4;
2781 run;
2782 Libname Merged 'C:\Users\Uokoro.HEALTHCARE\Desktop\Delirium\';
Without something that keeps SAS from recognizing all these statements, there would be additional messages between lines 2778/2779 and 2781/2782, documenting the success (or failure) of the LIBNAME statement and the DATA step.
Since these messages are all missing, this is either part of a macro definition, or you have unbalanced quotes further up in the code that let all this code look like a string literal.
Run your code step-by-step, and check the log after each step.
I tried this and it worked.
LIBNAME myperm "C:\temp\Merged\";
data myperm.Merged_data4;
set Merged_data4;
run;
Based on your statement, I took out the "sashelp" and it worked.
Thank you so much for your assistance.
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 25. Read more here about why you should contribute and what is in it for you!
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.