BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
UcheOkoro
Lapis Lazuli | Level 10

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

1 ACCEPTED SOLUTION

Accepted Solutions
UcheOkoro
Lapis Lazuli | Level 10

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.

 

View solution in original post

9 REPLIES 9
ChrisNZ
Tourmaline | Level 20

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.

 

UcheOkoro
Lapis Lazuli | Level 10

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.

ChrisNZ
Tourmaline | Level 20

Feel free not to take my comments into consideration. 

Kurt_Bremser
Super User

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.

UcheOkoro
Lapis Lazuli | Level 10

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;

 

 

Kurt_Bremser
Super User

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.

UcheOkoro
Lapis Lazuli | Level 10

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.

Kurt_Bremser
Super User

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.

UcheOkoro
Lapis Lazuli | Level 10

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.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 9 replies
  • 1115 views
  • 1 like
  • 3 in conversation