SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Tejaswini3
Obsidian | Level 7
I want to combine petest and desc coloumn one below the other
E g ,
Abdominal
No
Yes
Cardiovascular system
No
Yes
6 REPLIES 6
fja
Lapis Lazuli | Level 10 fja
Lapis Lazuli | Level 10

Looks like stacking cols ... this is available as a point and click task in Studio under Tasks->Data->Stack/Split Columns.

Generates something like this:

data work.TestData;  
   input Col1$ Col2$ Col3 $;  
   datalines;  
A B C 
D E F 
; 
run; 
 
data work.__tmp__;  
	set WORK.TESTDATA;  
	_Case_=_n_;  
run;  
  
proc transpose data=work.__tmp__ out=work.TestOut(drop=_Label_   
		rename=(col1=StackedCol)) name=_Level_;  
	var Col1 Col2;  
	by _Case_;  
run;  
  
proc delete data=WORK.__tmp__;  
run;
Tejaswini3
Obsidian | Level 7
Without transpose statement, pls write code to solve
fja
Lapis Lazuli | Level 10 fja
Lapis Lazuli | Level 10

@Tejaswini3 wrote:
Without transpose statement, pls write code to solve

Why is that? Than you needed to detail your problem a bit. ... let's say just to motivate people. 😉

 

Err ... being with it: My observation is that you keep on asking the same questions over and over (e.g. here and here ). You got answered there, though you have neither marked these threads as solved nor detailed what was missing to an acceptable solution. ... sooo, could you help us a bit, please?

Tejaswini3
Obsidian | Level 7
Can you please write full code and let me know
Kurt_Bremser
Super User

If you need someone to do your work for you, you should hire a consultant.

 

And you have neither answered my question, nor provided usable data.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 6 replies
  • 1073 views
  • 1 like
  • 3 in conversation