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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 781 views
  • 0 likes
  • 2 in conversation