01-26-2017 10:33 AM
I have a variable TERR which as both NUM and Char values such as first 10 obs as 1215, 1216.........1225 and then other 10 obs as PDS1 PDS2.....PDS10. But it is defined as Num and the other obs with PDS1-PDS10 are displayed as dot. I tried converting to char but I still see them missing. How can I get the Values for last 10 obs (PDS1-PDS10) in my data?
Here's my code to conversion:
set sam (rename=(Terr=Terr1));
01-26-2017 10:40 AM
Defined as NUM, by whom?
If you got mixed datatypes, stick to CHAR.
If your data haven't been modelled properly, you may need to restructure your data set.
01-26-2017 10:43 AM
You will need to go back to however you brought the data into SAS. Once SAS considered the variable as numeric anything not actually a valid number was set to missing. The solution is likely going to involve going back to the process that was used to bring the data into SAS and modifying it so all of the original values are retained.
The single most common cause of this confusion is using Proc Import to bring data into SAS. The procedure has to make "guesses" as to what the values should be and depending on the data source only a few rows of the data are examined to make those guesses. The defualt is the first 20 rows. For some file formats such as CSV there is an option to set GUESSINGROWS (note the name of the option) to use up to 32767 rows.