My dataset looks like this
And I want it to look like this:
Subject Code site subj
0156 00062 156 62
0156 00062 156 62
0047 00032 47 32
0034 00066 34 66
0032 00029 32 29
.
.
- My Code:
if "Subject Code"n ^="" then site=input(scan("Subject Code"n,1,' '),z9.);
put site=;
if "Subject Code"n ^="" thensubj=input(strip(substr((scan("Subject Code"n,-1)),1,4)),$4.);
put subj=;
The output I get:
site=15600062
subj=1560
As you can see SAS takes out the leading 0 values and the space " ", because of which it's difficult to split.