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.

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