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;

hackathon24-white-horiz.png

Join the 2025 SAS Hackathon!

Calling all data scientists and open-source enthusiasts! Want to solve real problems that impact your company or the world? Register to hack by August 31st!

Register Now

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
  • 783 views
  • 0 likes
  • 2 in conversation