<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: syntax in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/syntax/m-p/577590#M163670</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172715"&gt;@azhar7860&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;Sort by X Y, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = have out = stacked ;
  by X Y ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To generate the report a la in your Word doc, you'll need to process the sorted data set STACKED using some other SAS tool relying on BY processing, such as the DATA step, the REPORT procedure, etc. For example, using the DATA step (I'm, making some formatting assumptions here):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;                                                 
  input @1 X $36. @38 Y $23. ;                              
  cards ;                                                   
body as a whole - general disorders  o edema legs           
autonomic nervous system disorders   flushing               
body as a whole - general disorders  accidental injury      
body as a whole - general disorders  allergic reaction      
body as a whole - general disorders  chest pain             
application site disorders           injection site reaction
body as a whole - general disorders  fatigue                
body as a whole - general disorders  fever                  
body as a whole - general disorders  o edema dependent      
body as a whole - general disorders  pain                   
application site disorders           injection  site pain   
body as a whole - general disorders  rigors                 
;                                                           
run ;                                                       
                                                            
proc sort data = have out = stacked ;                       
  by X Y ;                                                  
run ;                                                       
                                                            
data _null_ ;                                               
  file print ;                                              
  set stacked (in = inX) stacked ;                               
  by X ;                                                    
  if first.X and inX then put X ;                          
  else put @ 5 Y ;                                          
run ;                                                       
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2019 04:15:08 GMT</pubDate>
    <dc:creator>hashman</dc:creator>
    <dc:date>2019-07-30T04:15:08Z</dc:date>
    <item>
      <title>syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax/m-p/577587#M163668</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have two categorical variables and i want to stack Y under X&amp;nbsp; &amp;nbsp;like it seen in my attached reference report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your input will be appreciated. Thanks kindly!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;APPLICATION SITE DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; injection&amp;nbsp; site pain&lt;/P&gt;&lt;P&gt;APPLICATION SITE DISORDERS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;injection site reaction&lt;/P&gt;&lt;P&gt;AUTONOMIC NERVOUS SYSTEM DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; flushing&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;ACCIDENTAL INJURY&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ALLERGIC REACTION&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CHEST PAIN&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FATIGUE&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FEVER&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; O EDEMA DEPENDENT&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; O EDEMA LEGS&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PAIN&lt;/P&gt;&lt;P&gt;BODY AS A WHOLE - GENERAL DISORDERS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RIGORS&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 03:49:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax/m-p/577587#M163668</guid>
      <dc:creator>azhar7860</dc:creator>
      <dc:date>2019-07-30T03:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax/m-p/577590#M163670</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172715"&gt;@azhar7860&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;Sort by X Y, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = have out = stacked ;
  by X Y ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To generate the report a la in your Word doc, you'll need to process the sorted data set STACKED using some other SAS tool relying on BY processing, such as the DATA step, the REPORT procedure, etc. For example, using the DATA step (I'm, making some formatting assumptions here):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;                                                 
  input @1 X $36. @38 Y $23. ;                              
  cards ;                                                   
body as a whole - general disorders  o edema legs           
autonomic nervous system disorders   flushing               
body as a whole - general disorders  accidental injury      
body as a whole - general disorders  allergic reaction      
body as a whole - general disorders  chest pain             
application site disorders           injection site reaction
body as a whole - general disorders  fatigue                
body as a whole - general disorders  fever                  
body as a whole - general disorders  o edema dependent      
body as a whole - general disorders  pain                   
application site disorders           injection  site pain   
body as a whole - general disorders  rigors                 
;                                                           
run ;                                                       
                                                            
proc sort data = have out = stacked ;                       
  by X Y ;                                                  
run ;                                                       
                                                            
data _null_ ;                                               
  file print ;                                              
  set stacked (in = inX) stacked ;                               
  by X ;                                                    
  if first.X and inX then put X ;                          
  else put @ 5 Y ;                                          
run ;                                                       
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 04:15:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax/m-p/577590#M163670</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-07-30T04:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax/m-p/578742#M164185</link>
      <description>&lt;P&gt;Thanks paul. Its working fine with the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp; got the counts and the %(row) for both the variables in a separate data-sets, but unable to&amp;nbsp; stack the X (Preferred term) variable data-set&amp;nbsp; under the Y(System organ class) variable data-set e like it shows in my attached report.docx.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your input will be appreciated!!!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 15:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax/m-p/578742#M164185</guid>
      <dc:creator>azhar7860</dc:creator>
      <dc:date>2019-08-02T15:19:54Z</dc:date>
    </item>
  </channel>
</rss>

