BookmarkSubscribeRSS Feed
lanec23
Calcite | Level 5

How to read in permanent vs temporary dataset? Most of the data I have read into SAS has code as follows: 

 

libname ILE2023 "/home/u60777348/ILE2023";

data BRFSSILE;
set ILE2023.brfss2018;
run;

 

I see this is temporary because of the set statement, it is creating a temporary dataset from the "brfss2018" data. What would reading in the permanent dataset "brfss2018" code look like? 

 

Thanks for any help-much appreciated. 

6 REPLIES 6
Tom
Super User Tom
Super User

I am not sure what your question is. The code you posted IS reading in a permanent dataset named brfss2018.  It is reading the one that lives in the directory named /home/u60777348/ILE2023.

 

So the code you posted is reading the dataset the lives in the file named /home/u60777348/ILE2023/brfss2018.sas7bdat .

lanec23
Calcite | Level 5

I see, thank you. In switching around my lines, the code that I was originally using, listed above, now isn't running. I don't know how this is even possible. I am getting the error message "The table "WORK.BRFSSILE" cannot be opened because it does not contain any columns." from the code 

libname ILE2023 "/home/u60777348/ILE2023";
data BRFSSILE;
set ILE2023.brfss2018;
run;

 

which ran perfectly fine before. Any idea what's happening? Nothing like this has ever happened to me before. 

Tom
Super User Tom
Super User

If you got that error after running that data step then the permanent dataset also has no variables.

 

You probably accidentally ran a data step like this:

data ILE2023.brfss2018;
run;

Which would make a new dataset with no variables.

 

You probably need to re-create the "permanent" dataset.  And you have learned that nothing is permanent.

lanec23
Calcite | Level 5

That was the step so that explains it. Do I need to redownload the data again? 

quietann
Calcite | Level 5
Yes, you do. It's so easy to "lose" a dataset this way; you have my sympathies!
Patrick
Opal | Level 21

@lanec23 wrote:

That was the step so that explains it. Do I need to redownload the data again? 


Yes, you do.

One way to protect yourself against such situations where you overwrite by mistake a source table is to strictly separate source from target locations and to assign source locations read only. In your case below libname syntax would have protected you.

libname ILE2023 "/home/u60777348/ILE2023" access=readonly;

 

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!

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
  • 6 replies
  • 449 views
  • 0 likes
  • 4 in conversation