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. 1 3454
  2. 4 4231
  3. 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:

  1. The person disco new_disco
  2. 1 3454 3
  3. 3 4534 4
  4. 4 5 423 4
  5. 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

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -