Create new variable in sas, which is equal to the first digit of another variable -
I have a data set in SAS, which looks like the following:
- 1 3454
- 4 4231
- 5 5343
named variable From the disk, I want to create a new variable, which is equal to the first digit of the disco variable:
- The person disco new_disco
- 1 3454 3
- 3 4534 4
- 4 5 423 4
- 5 5343 5
I also want a numeric variable to be a numeric variable.
Thank you
You get the substr ()
and < Code> input () functions need to be aligned:
data is new; Old set; New_disco = input (substr (disco, 1,1), 8.); Run;
Comments
Post a Comment