BookmarkSubscribeRSS Feed
Malathi13
Obsidian | Level 7

Hi,

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:

data Sams1;

set sam (rename=(Terr=Terr1));

Terr=put(Terr1,7.);

drop Terr1;

run;

 

Thank you

Malathi

3 REPLIES 3
LinusH
Tourmaline | Level 20

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.

Data never sleeps
ballardw
Super User

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.

Malathi13
Obsidian | Level 7

Thank you, I made the changes in the excel and it worked.

 

Malathi

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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