BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vinpres
Fluorite | Level 6

Hi to all,

please, can anyone help me in how to create a permanent dataset with one column?

I want to create a permanent dataset (MyDataset.sas7dbat) with only one column "STATUS", to a given library to a given path.

Can any one help me?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I get the feeling that there's really more to this question, but you haven't provided details.

 

Nevertheless, here is code

 

libname perm "c:\users\<username>\documents\myfolder";
/* Note: you must change the above to reference a valid and existing folder */
data perm.mydataset;
    status=1;
run;
--
Paige Miller

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

I get the feeling that there's really more to this question, but you haven't provided details.

 

Nevertheless, here is code

 

libname perm "c:\users\<username>\documents\myfolder";
/* Note: you must change the above to reference a valid and existing folder */
data perm.mydataset;
    status=1;
run;
--
Paige Miller
vinpres
Fluorite | Level 6

Hi @PaigeMiller 

Great!

I have created the dataset and I see it in libname directory.

But where I find the basic guide about dataset programming?

For example, I want be able also delete a dataset but also add/delete columns and update data.

 

Thanks in advance.

PaigeMiller
Diamond | Level 26

@vinpres wrote:

Hi @PaigeMiller 

Great!

I have created the dataset and I see it in libname directory.

But where I find the basic guide about dataset programming?


I don't know.

 

For example, I want be able also delete a dataset but also add/delete columns and update data.

Deleting data sets can be done manually (depending on your user interface) by right-clicking on the data set and selecting Delete or by using PROC DELETE. Adding or deleting columns and updating data can be done in a DATA step or in PROC SQL or by various different SAS PROCs such as PROC STDIZE (and many others). More specific information about what you want to do will lead to more specific answers.

--
Paige Miller
ballardw
Super User

With SAS once you have created the data set you cannot add or delete variables (columns is spreadsheet thinking and will lead you astray eventually). You would need to create a new data set with the added or deleted variables. However for use one a data set exists you can ignore specified variables with data set option DROP and not use specific observations (rows) with either a Where data set option or statement or less frequently options like Firstobs and Obs.

 

Updating data methods will depend on a number of conditions depending on exactly what you might mean by "update".

 

Search for the Free SAS Programming tutorials.

Proc DATASETS can modify some properties of data sets and variables but not change values or number of observationsw

novinosrin
Tourmaline | Level 20

"But where I find the basic guide about dataset programming?"- The question gives me the impression you are perhaps in the same situation as me back in FEB2014 when I actually started learning SAS. I would recommend buying the book- 

Learning SAS by Example: A Programmer's Guide, Second Edition

Book by Ron Cody

 

All the best!

tarheel13
Rhodochrosite | Level 12
The SAS programming 1 course is free. You can also get a free month of e-learning from SAS.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1605 views
  • 0 likes
  • 5 in conversation