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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 5201 views
  • 4 likes
  • 4 in conversation