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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 226 views
  • 0 likes
  • 4 in conversation