BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

Try it an see.

filename junk temp;
data _null_;
  file junk;
  do len=10 to 0 by -1;
     x='12345678901234567890';
     put x $varying10. len ;
  end;
run;

data _null_;
  infile junk length=fred;
  input;
  put _n_= fred= @20 _infile_;
run;
_N_=1 fred=10      1234567890
_N_=2 fred=9       123456789
_N_=3 fred=8       12345678
_N_=4 fred=7       1234567
_N_=5 fred=6       123456
_N_=6 fred=5       12345
_N_=7 fred=4       1234
_N_=8 fred=3       123
_N_=9 fred=2       12
_N_=10 fred=1      1
_N_=11 fred=0
NOTE: 11 records were read from the infile JUNK.
      The minimum record length was 0.
      The maximum record length was 10.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 15 replies
  • 3208 views
  • 4 likes
  • 4 in conversation