BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I have a sas data as below
Name Age Coll
Mohan 25 Anna
xxxxx 33 xxxxx
vnsjdn 56 DNSKN

I want the above data to be printed in below format

Name: Mohan
Age : 25
Coll: Anna

Name:xxxxx
Age:33
Coll:xxxxx

Name:
Age:
Coll:

Could any one please help me to get this accomplished?
1 REPLY 1
Peter_C
Rhodochrosite | Level 12
proc forms
or[pre]data _null_ ;
file 'your output.file.txt' ;
set your_data;
put 'name :' +1 name / 'age :' +1 age / 'Coll :' +1 coll ;
run ;[/pre]It could be simpler if you accept '=' instead of ' : ' [pre]data _null_ ;
file 'your.equal.file.txt' ;
set your_data ;
put (name age coll) (/=) ; * <-- > / for newline =for "named output " ;
run ;[/pre]
peterC
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
  • 1 reply
  • 1221 views
  • 0 likes
  • 2 in conversation