how to go to the next line in a %window

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

how to go to the next line in a %window

hello,

I created a macro variable  in this way:

 

proc sql;
select NAME
into :totale separated by ' '
from contenst;
quit;

 

The log of '%put &totale;' is:

 

LDL PAD PAS age altezza birth_date bmi

 

This is the window that I wrote:

 

%window info

#5 @5 'these are the variable of your dataset:'
#8 @5 "&totale"
#5 @60 'enter the variable you want to keep'
#7 @60 'names:' +1 newtot 600 attr=underline display=yes;
%display info;

 

With this program I see 'LDL PAD PAS age altezza birth_date bmi' in a row, but I would like to display them in a column, in this way:

 

these are the variable of your dataset:

LDL

PAD

PAS

age 

...

 

how can I do?

 


Accepted Solutions
Solution
‎06-03-2018 07:06 PM
Super User
Posts: 6,781

Re: how to go to the next line in a %window

[ Edited ]
Posted in reply to SuryaKiran

I agree 1000% that you need a set of macro variables instead of 1.  However, I would change the interaction and requirements to make life easier for the user and to eliminate spelling mistakes.  For example:

%window info                                                                                                                            
                                                                                                                                        
#5 @5 'these are the variable of your dataset:'                                                                                         
#8 @5 keep1 1  attr=underline display=yes @8 "&totale1"                                                                                                                        
 / @5 keep2 1  attr=underline display=yes @8 "&totale2" 

/ @5 keep3 1 attr=underline display=yes @8 "&totale3"
/ @......
#5 @60 'Put a "K" before each variable that you want to keep' ;

 

Do you know how to get separate macro variables instead of one long one?

View solution in original post


All Replies
Valued Guide
Posts: 596

Re: how to go to the next line in a %window

Posted in reply to leti_ors96

Forward slash will write to next line, but you need to define separate macros to put them in separate lines

 

                                                                                                                                        
%let totale1=LDL;                                                                                                                       
%let totale2=PAD;                                                                                                                       
%let totale3=PAS;                                                                                                                       
%let totale4=age;                                                                                                                       
%let totale5=altezza;                                                                                                                   
%let totale6=birth_date;                                                                                                                
%let totale7=bmi;                                                                                                                       
                                                                                                                                        
%window info                                                                                                                            
                                                                                                                                        
#5 @5 'these are the variable of your dataset:'                                                                                         
#8 @5 "&totale1"                                                                                                                        
 / @5 "&totale2"                                                                                                                        
 / @5 "&totale3"                                                                                                                        
 / @5 "&totale4"                                                                                                                        
 / @5 "&totale5"                                                                                                                        
 / @5 "&totale6"                                                                                                                        
 / @5 "&totale7"                                                                                                                        
#5 @60 'enter the variable you want to keep'                                                                                            
#7 @60 'names:' +1 newtot 600 attr=underline display=yes;                                                                               
%display info;
Thanks,
Suryakiran
Solution
‎06-03-2018 07:06 PM
Super User
Posts: 6,781

Re: how to go to the next line in a %window

[ Edited ]
Posted in reply to SuryaKiran

I agree 1000% that you need a set of macro variables instead of 1.  However, I would change the interaction and requirements to make life easier for the user and to eliminate spelling mistakes.  For example:

%window info                                                                                                                            
                                                                                                                                        
#5 @5 'these are the variable of your dataset:'                                                                                         
#8 @5 keep1 1  attr=underline display=yes @8 "&totale1"                                                                                                                        
 / @5 keep2 1  attr=underline display=yes @8 "&totale2" 

/ @5 keep3 1 attr=underline display=yes @8 "&totale3"
/ @......
#5 @60 'Put a "K" before each variable that you want to keep' ;

 

Do you know how to get separate macro variables instead of one long one?

New Contributor
Posts: 4

Re: how to go to the next line in a %window

Posted in reply to Astounding

I don't know how to create one macro variable for each name. I have a dataset and I have to create for each variable of the dataset a macro variable. How can I do?

Super User
Posts: 6,781

Re: how to go to the next line in a %window

[ Edited ]
Posted in reply to leti_ors96

Similar to what you did in the first place, to create a separate macro variable holding each variable's name:

 

proc sql;

select name into : totale1 - : totale99 from contents;

quit;

 

My recollection (can't test it right now) is that this creates only as many macro variables as needed.  I'm assuming that 99 variables is more than enough, since you won't be able to display that many in a single window.

 

I'm also concerned that you won't be able to use the results later, since it may require additional skills with macro language.  But you will have to be the judge of that.

New Contributor
Posts: 4

Re: how to go to the next line in a %window

Posted in reply to leti_ors96
Your recollection works. Now I have to understand how to display all the macro variables in the window.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 148 views
  • 0 likes
  • 3 in conversation