BookmarkSubscribeRSS Feed
omega1983
Calcite | Level 5

I will pull a spreadsheet each month from an outside source.  Their program requires the following:  Account#

I had been using the following to show the ln_no however I am getting an Account_ unitialized.  This is because the dataset I import in shows Account#.

1.  Is there a way to rename the Account# even though sas evaluates this differently and not as a text

2.  Also the account# needs to be a character and needs to show leading zeros if it is less than 10.  Some of the account numbers show more than 10 (ie 9.4201471E12 or 88089745000)

data loans2;

  length ln_no $10;

  set loans;

  

  if Account__ = . then ln_no = ' ';

else ln_no = put(input(Account__,??10.),z10.);

1 REPLY 1
Scott_Mitchell
Quartz | Level 8

You need to reference the variable as a name literal as it is not a valid SAS name.  Enclose the variable name with quotation marks followed by an N like so Account#"n.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 692 views
  • 0 likes
  • 2 in conversation