<?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: Stratify groups under yes/no in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Stratify-groups-under-yes-no/m-p/921447#M41339</link>
    <description>&lt;P&gt;If you want to count values by more than 2 variables Proc Freq is still likely to be the tool but you need additional syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure what variable as you didn't describe your data very well but consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc freq data=temp;
  /* default table for two variables*/
   tables diabetes_P1 * Finalgold_p1;
  /* different layout table*/
   tables  diabetes_P1 * Finalgold_p1/ list;
  /* different layout but shows MISSING values in context*/
  tables diabetes_p1 *Finalgold_p1 / list missing;

/* you don't have to use a data step to assign a format you 
   do that in procedures that use the variable */
  format diabetes_p1 diabetes_baseline.;
run;&lt;/PRE&gt;
&lt;P&gt;Strongly suggest that you provide actual example data and the appearance of the result you want. You should also tell us whether you want a data set (caution: some may not be possible or extremely hard to work with) or a report that people read. Also list by name variables that hold values. I have to &lt;STRONG&gt;guess &lt;/STRONG&gt;that Finalgold_P1 is the variable that holds "each gold stage" because you did not mention the variable as holding those stages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add options in proc freq to suppress percentages, column percentages, row percentages and cumulative totals if desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate and Proc Report will also do counts as well as much more to make 'pretty' reports.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2024 05:29:43 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-03-22T05:29:43Z</dc:date>
    <item>
      <title>Stratify groups under yes/no</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Stratify-groups-under-yes-no/m-p/921443#M41338</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to compare the prevalence of lung function between diabetics and non-diabetics.&amp;nbsp;I have a data set that assigns a GOLD stage (-1 - 4) to each individual.&amp;nbsp; I separated the individuals into yes/no by diabetes status at baseline.&amp;nbsp; I need to write code that then lists the frequency of each stage for each diabetic yes/no (so both yes and no categories will have stages -1 -4).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the earlier code that I wrote to separate individuals by diabetes status yes/no: Works great&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format; 
	value diabetes_baseline
	0 = 'No'
	1 = 'Yes'
	other = 'missing';
run;

data temp1;
	set temp;
	format diabetes_P1 diabetes_baseline.;
run;

Proc freq data = temp1;
	tables diabetes_P1;
	run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I know this code is incorrect because I'm using the same stage numbers and giving them different names based on diabetes status.&amp;nbsp; I'm not even certain I should be using an if/then statement, but this is what I have....&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	value DMBaseline_Gold_Stage
	-1 = 'Gold Stage -1'&lt;BR /&gt;       *insert others once this works;
	other = 'missing'; 
run;

proc format;
	value Cntrl_Baseline_Gold_Stage
	-1 = 'Gold Stage -1'
         *insert others once this works;
	other = 'missing'; 
run;

data temp1;
	set temp;
		where finalgold_P1;
		if finalgold_P1 = -1 and diabetes_baseline = 1 then DMBaseline_Gold_Stage = -1;
		else if finalgold_P1=-1 and diabetes_baseline = 0 then Cntrl_Baseline_Gold_Stage =-1;
		* fill in other stages here once code works;
		format DMBaseline_Gold_Stage DMBaseline_Gold_Stage.;
		format Cntrl_Baseline_Gold_Stage Cntrl_Baseline_Gold_Stage.;
		format diabetes_P1 diabetes_baseline.;
	run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I don't need the new categories of DMBaseline_Gold_stage nor Cntrl_baseline_Gold_stage.&amp;nbsp; I simply want to list the frequency of each gold stage within the yes/no diabetes categories.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry this is so long. Any help is much appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 03:49:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Stratify-groups-under-yes-no/m-p/921443#M41338</guid>
      <dc:creator>kristiepauly</dc:creator>
      <dc:date>2024-03-22T03:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Stratify groups under yes/no</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Stratify-groups-under-yes-no/m-p/921447#M41339</link>
      <description>&lt;P&gt;If you want to count values by more than 2 variables Proc Freq is still likely to be the tool but you need additional syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure what variable as you didn't describe your data very well but consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc freq data=temp;
  /* default table for two variables*/
   tables diabetes_P1 * Finalgold_p1;
  /* different layout table*/
   tables  diabetes_P1 * Finalgold_p1/ list;
  /* different layout but shows MISSING values in context*/
  tables diabetes_p1 *Finalgold_p1 / list missing;

/* you don't have to use a data step to assign a format you 
   do that in procedures that use the variable */
  format diabetes_p1 diabetes_baseline.;
run;&lt;/PRE&gt;
&lt;P&gt;Strongly suggest that you provide actual example data and the appearance of the result you want. You should also tell us whether you want a data set (caution: some may not be possible or extremely hard to work with) or a report that people read. Also list by name variables that hold values. I have to &lt;STRONG&gt;guess &lt;/STRONG&gt;that Finalgold_P1 is the variable that holds "each gold stage" because you did not mention the variable as holding those stages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add options in proc freq to suppress percentages, column percentages, row percentages and cumulative totals if desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate and Proc Report will also do counts as well as much more to make 'pretty' reports.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 05:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Stratify-groups-under-yes-no/m-p/921447#M41339</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-22T05:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Stratify groups under yes/no</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Stratify-groups-under-yes-no/m-p/921573#M41342</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. I apologize for the lack of information.&amp;nbsp; I thought I was including too much.&amp;nbsp; The "List" statement was exactly what I needed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2024 00:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Stratify-groups-under-yes-no/m-p/921573#M41342</guid>
      <dc:creator>kristiepauly</dc:creator>
      <dc:date>2024-03-23T00:30:19Z</dc:date>
    </item>
  </channel>
</rss>

