BookmarkSubscribeRSS Feed
deleted_user
Not applicable
hey i am a newbee in SAS...and i need a lot of help. could amyone please tell me how to modify permanent data sets in programs?
thnx
4 REPLIES 4
deleted_user
Not applicable
Usually you use a datastep, which could look something like:


data MyLibrary.MyPermanentSASDataset; set MyLibrary.MyPermanentSASDataset;
* Place your modifications here, e.g.;
var2 = var1 * 2;
run;
deleted_user
Not applicable
1.HOW do i read a tab separated text file using the DATA command?
2.how do i edit a variable's properties of a permanent data set?(meaning changing it from character to numeric or vice versa)
3. can i specify the format of the variables in the proc import command?
deleted_user
Not applicable
1. You could use something like this:
data work.MyDSN;
infile "MyPathToMyRawDatafile\RawDataFile" dlm = '09'x;
input charvar1 $ charvar2 $ numvar1 ;
run;

2. To change the type of a variable you could create a new variable and put the old variable into the new one. If you want you can drop the old variable as well;

data MyDSN; set MyDSN;
length numvar_new 8 charvar_new $ 4;
numvar_new = put(charvar_old,1.0);
charvar_new = put(numvar_old,1.0);
* If the old variables are no longer wanted;
drop charvar_old numvar_old;
run;

3. The SAS Help Documentation does not mention such an option, thus the answer is: no. If you want to use formats you should add a datastep after the proc import in which you specify the formats for each variable OR you use a datastep to import (instead of proc import) and specify there which formats the variables should have.
DouglasMartin
Calcite | Level 5
the first put (that you are using to convert to a numeric) should be input.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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