<?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: Get all SOC in proc format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711500#M219200</link>
    <description>Yeah the table is actually a little more detailed than just SOC and PT though. I have to also use AESEV and AEREL. I think it may be more time researching a workaround for this than just writing out &amp;amp;soc1 up to &amp;amp;soc27.&lt;BR /&gt;</description>
    <pubDate>Thu, 14 Jan 2021 16:55:13 GMT</pubDate>
    <dc:creator>tarheel13</dc:creator>
    <dc:date>2021-01-14T16:55:13Z</dc:date>
    <item>
      <title>Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711482#M219190</link>
      <description>&lt;P&gt;Is there a way to get all the SOCs into a proc format step?&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="303"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Subject&amp;nbsp;&lt;/TD&gt;
&lt;TD width="175"&gt;aeterm_Soc&lt;/TD&gt;
&lt;TD width="64"&gt;aeterm_PT&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;Cardiac disorders&lt;/TD&gt;
&lt;TD&gt;arrhythmia&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;Respiratory disorders&lt;/TD&gt;
&lt;TD&gt;Pulmonary embolism&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;Vascular disorders&lt;/TD&gt;
&lt;TD&gt;hypertension&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Anemia&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Anemia&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;Vascular disorders&lt;/TD&gt;
&lt;TD&gt;DVT&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Lymphopenia&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;Infections and infestations&lt;/TD&gt;
&lt;TD&gt;Septic shock&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Lymphopenia&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;Respiratory disorders&lt;/TD&gt;
&lt;TD&gt;Pneumothorax&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;Psychiatric disorders&lt;/TD&gt;
&lt;TD&gt;Agitation&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Here is some sample data. I am making an AE table using proc report and preloadfmt. This is what I do but I have to keep adding more to the proc format as more SOCs present in the data. Is there a way to make this more dynamic?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select distinct aeterm_soc into :soc1 -&lt;/P&gt;
&lt;P&gt;from adae; quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;/P&gt;
&lt;P&gt;value $ descr (multilabel notsorted)&lt;/P&gt;
&lt;P&gt;"&amp;amp;soc1","&amp;amp;soc2","&amp;amp;soc3"="All Events"&lt;/P&gt;
&lt;P&gt;"&amp;amp;soc1"="&amp;amp;soc1"&lt;/P&gt;
&lt;P&gt;"&amp;amp;soc2"="&amp;amp;soc2"&lt;/P&gt;
&lt;P&gt;"&amp;amp;soc3"="&amp;amp;soc3"&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;There are 27 SOCs in MedDRA. Is there a better way to do this so I wouldn't have to hypothetically write "&amp;amp;soc1"="&amp;amp;soc1" all the way to "&amp;amp;soc27"="&amp;amp;soc27"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 15:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711482#M219190</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-01-14T15:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711483#M219191</link>
      <description>&lt;P&gt;What does this partial data set have to do with your problem?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where does &amp;amp;soc1 (and all the others) get defined?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would you need a format "&amp;amp;soc1"="&amp;amp;soc1", essentially assigning to the text string a format that is equal to this exact text string?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 15:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711483#M219191</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-14T15:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711485#M219192</link>
      <description>&lt;P&gt;There is this example that show how to convert a dataset into a format.&amp;nbsp; It does not address your multilabel features.&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1e19y6lrektafn1kj6nbvhus59w.htm&amp;amp;locale=en"&gt;SAS Help Center: Creating a Format from a CNTLIN= Data Set&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;To make the simple (non multilabel format) you'll do the SAS equivalent of making your given dataset look like this (ignoring repeats):&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="276px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;&lt;STRONG&gt;Start&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;&lt;STRONG&gt;End&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;&lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Cardiac disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Cardiac disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Cardiac disorders&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Respiratory disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Respiratory disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Respiratory disorders&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Vascular disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Vascular disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Vascular disorders&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Vascular disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Vascular disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Vascular disorders&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Infections and infestations&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Infections and infestations&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Infections and infestations&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Blood disorders&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Respiratory disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Respiratory disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Respiratory disorders&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="92.1739px"&gt;Psychiatric disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Psychiatric disorders&lt;/TD&gt;
&lt;TD width="91.3044px"&gt;Psychiatric disorders&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Then you'll add other columns, like "FMTNAME".&amp;nbsp; If you can make this happen then there are a couple of steps to go from a regular format to a multilabel format.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 16:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711485#M219192</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-14T16:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711486#M219193</link>
      <description>&lt;P&gt;To give context of the problem I am trying to solve!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I included the proc sql step where the macro variables are assigned!&lt;/P&gt;
&lt;P&gt;And because I have to count the AEs by SOC and PT and I needed a row for "All Events".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 16:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711486#M219193</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-01-14T16:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711489#M219195</link>
      <description>&lt;P&gt;Formatting of the sort you are talking about is not required to do counting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC FREQ or PROC REPORT or PROC TABULATE or PROC MEANS or PROC SUMMARY does all of this on your data set without creating these formats, and will create totals across all events, again without these formats being created.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 16:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711489#M219195</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-14T16:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711493#M219197</link>
      <description>&lt;P&gt;Yes, if you read the OP, I said that I do use preloadfmt with proc report. This is a step that I do before that. I know what proc freq does. I guess you don't really understand what I was asking. I have a table shell that I have to work off of.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 16:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711493#M219197</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-01-14T16:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711499#M219199</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;is correct.&amp;nbsp; Preloaded formats and multilabel formats are two different features that operate with many procedures.&amp;nbsp; How I am, and perhaps how Paige may be, thinking is that one would use PROC TABULATE to summarize the total.&amp;nbsp; So PROC TABULATE is powerful and lets just keep it at that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table SOC as
    select distinct cause as aeterm_soc 
    from SASHELP.failure; 
quit;


data SOC;
   set SOC end=eod;

   start=aeterm_soc;
   end  =aeterm_soc;
   label=aeterm_soc;

   retain fmtname 'descr' 
          type 'C' 
          HLO "M";

   output; /*Regular entry*/

   Label="All Events";
   output; /*multilabel "All Events"*/

;
run;

proc format library=work cntlin=SOC;
run;

Title "with multilabel formats";
PROC TABULATE DATA=SASHELP.FAILURE (obs=4)	;
  FORMAT Cause $descr.;
	CLASS Cause /	  PRELOADFMT MLF;
	TABLE Cause,N /printmiss		;
RUN;

Title "with out multilabel formats";
PROC TABULATE DATA=SASHELP.FAILURE (obs=4)	;
  FORMAT Cause $descr.;
	CLASS Cause /	  PRELOADFMT ;
	TABLE (Cause all="All Events"),N /printmiss		;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 16:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711499#M219199</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-14T16:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get all SOC in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711500#M219200</link>
      <description>Yeah the table is actually a little more detailed than just SOC and PT though. I have to also use AESEV and AEREL. I think it may be more time researching a workaround for this than just writing out &amp;amp;soc1 up to &amp;amp;soc27.&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Jan 2021 16:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-all-SOC-in-proc-format/m-p/711500#M219200</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-01-14T16:55:13Z</dc:date>
    </item>
  </channel>
</rss>

