BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
frakje
Calcite | Level 5

Hi

 

I have a char var called "cpr". My problem is when i transforms it into a numeric variable it is dropping the the start number 0 for those obs who starts with zero and returns a 9 digit num var.

 

CPR = 0101079010

 

data want;

set have;

cpr2 = input(CPR,best12.);

run;

 

returned value of cpr2 = 101079010.

 

I want that to look like the same CPR var with 10 digits but as a num var instead of a char.

 

Kind regards Frank

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Add a format in it.

 

data want;

set have;

cpr2 = input(CPR,best12.);

format cpr2 z10.;

run;

View solution in original post

2 REPLIES 2
Ksharp
Super User

Add a format in it.

 

data want;

set have;

cpr2 = input(CPR,best12.);

format cpr2 z10.;

run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 363 views
  • 0 likes
  • 2 in conversation