<?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: generating standard deviation from PROC FREQ out put in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/456708#M115712</link>
    <description>&lt;P&gt;Which variable(s) are coded Y N? Not at all clear.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are already using a data step to modify your data it might be worth creating a numeric&amp;nbsp;0/1 coding (1=Y_.&lt;/P&gt;
&lt;P&gt;Then go directly to proc means using the 0/1 coded variable. The mean will be the percentage of Y values with a corresponding deviation.&lt;/P&gt;
&lt;P&gt;add a class statement to proc means to get summary statistics with in your groups.&lt;/P&gt;
&lt;P&gt;Assuming you name that numeric variable SurvivalNum:&lt;/P&gt;
&lt;PRE&gt;proc means data=treesSAS;
   class Species Measurement Fert Nfix; 
   types Species Measurement Fert Nfix; 
   var SurvivalNum; 
RUN;&lt;/PRE&gt;
&lt;P&gt;the Types statement lets select combinations of things for the summary. You could add Species*Fert to get a summary of SurvivalNum for combinations of those two.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Apr 2018 22:33:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-04-23T22:33:15Z</dc:date>
    <item>
      <title>generating standard deviation from PROC FREQ out put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/456704#M115709</link>
      <description>&lt;P&gt;I have data for Survival collected from 4 plots in 4 blocks (n=16, N=4) marked as Y or N, so i used Proc FREQ via:&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC FREQ data=TreesSAS;&lt;BR /&gt;by Species Measurement Fert Nfix;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;TABLES Survival;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and it generated a tables for each tree species, by measurement (Date) and treatment (Fert and Nfix), withe accompanying frequency, percent, cum. freq. and cum. perc.&lt;/P&gt;&lt;P&gt;Since Y and N are not numbers, they can't be analyzed for variance, but i would like to generate a standard deviation value for this data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using output out=Survival&amp;nbsp; and then using the Proc Means statement with data=Survival, but the error message says that Survival does not exist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i generate a Standard Deviation value for Survival in my data set?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%web_drop_table(WORK.IMPORT);&lt;/P&gt;&lt;P&gt;FILENAME FILEREF '/folders/myfolders/TreesSAS.xlsx';&lt;/P&gt;&lt;P&gt;PROC IMPORT DATAFILE=FILEREF&lt;BR /&gt;DBMS=XLSX&lt;BR /&gt;OUT=WORK.IMPORT;&lt;BR /&gt;GETNAMES=YES;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;data TreesSAS;&lt;BR /&gt;set import;&lt;BR /&gt;&lt;BR /&gt;if Leave='Y' then Delete;&lt;BR /&gt;if row=1 then Delete;&lt;BR /&gt;if row=6 then Delete;&lt;BR /&gt;if Tree=1 then Delete;&lt;BR /&gt;if Tree=13 then Delete;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 22:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/456704#M115709</guid>
      <dc:creator>AaronJ</dc:creator>
      <dc:date>2018-04-23T22:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: generating standard deviation from PROC FREQ out put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/456708#M115712</link>
      <description>&lt;P&gt;Which variable(s) are coded Y N? Not at all clear.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are already using a data step to modify your data it might be worth creating a numeric&amp;nbsp;0/1 coding (1=Y_.&lt;/P&gt;
&lt;P&gt;Then go directly to proc means using the 0/1 coded variable. The mean will be the percentage of Y values with a corresponding deviation.&lt;/P&gt;
&lt;P&gt;add a class statement to proc means to get summary statistics with in your groups.&lt;/P&gt;
&lt;P&gt;Assuming you name that numeric variable SurvivalNum:&lt;/P&gt;
&lt;PRE&gt;proc means data=treesSAS;
   class Species Measurement Fert Nfix; 
   types Species Measurement Fert Nfix; 
   var SurvivalNum; 
RUN;&lt;/PRE&gt;
&lt;P&gt;the Types statement lets select combinations of things for the summary. You could add Species*Fert to get a summary of SurvivalNum for combinations of those two.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 22:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/456708#M115712</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-23T22:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: generating standard deviation from PROC FREQ out put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/456720#M115718</link>
      <description>&lt;P&gt;The Y / N variable is "Survival", simply a column indicating that the tree is alive.&lt;/P&gt;&lt;P&gt;So I took you up on your idea, and entered&lt;/P&gt;&lt;P&gt;if Survival=&amp;nbsp;'Y' then 1;&lt;/P&gt;&lt;P&gt;if Survival='N' then 0;&lt;/P&gt;&lt;P&gt;in the data step&lt;/P&gt;&lt;P&gt;and it gave me the Statement is not valid or used out of proper order error message.&lt;/P&gt;&lt;P&gt;How/where should i include this modification?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data TreesSAS;&lt;BR /&gt;set import;&lt;BR /&gt;&lt;BR /&gt;if Leave='Y' then Delete;&lt;BR /&gt;if row=1 then Delete;&lt;BR /&gt;if row=6 then Delete;&lt;BR /&gt;if Tree=1 then Delete;&lt;BR /&gt;if Tree=13 then Delete;&lt;BR /&gt;if Survival='N' then 0;&lt;BR /&gt;if Survival='Y' then 1;&lt;BR /&gt;logGLD=log(GLD);&lt;BR /&gt;logDBH=log(DBH);&lt;BR /&gt;logHt=log(Ht);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 23:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/456720#M115718</guid>
      <dc:creator>AaronJ</dc:creator>
      <dc:date>2018-04-23T23:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: generating standard deviation from PROC FREQ out put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/457059#M115857</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/97352"&gt;@AaronJ&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The Y / N variable is "Survival", simply a column indicating that the tree is alive.&lt;/P&gt;
&lt;P&gt;So I took you up on your idea, and entered&lt;/P&gt;
&lt;P&gt;if Survival=&amp;nbsp;'Y' then 1;&lt;/P&gt;
&lt;P&gt;if Survival='N' then 0;&lt;/P&gt;
&lt;P&gt;in the data step&lt;/P&gt;
&lt;P&gt;and it gave me the Statement is not valid or used out of proper order error message.&lt;/P&gt;
&lt;P&gt;How/where should i include this modification?&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data TreesSAS;&lt;BR /&gt;set import;&lt;BR /&gt;&lt;BR /&gt;if Leave='Y' then Delete;&lt;BR /&gt;if row=1 then Delete;&lt;BR /&gt;if row=6 then Delete;&lt;BR /&gt;if Tree=1 then Delete;&lt;BR /&gt;if Tree=13 then Delete;&lt;BR /&gt;if Survival='N' then 0;&lt;BR /&gt;if Survival='Y' then 1;&lt;BR /&gt;logGLD=log(GLD);&lt;BR /&gt;logDBH=log(DBH);&lt;BR /&gt;logHt=log(Ht);&lt;BR /&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you want to assign a value to a variable you have to reference the target variable:&lt;/P&gt;
&lt;P&gt;Instead of:&lt;/P&gt;
&lt;P&gt;if Survival='N' then 0;&lt;BR /&gt;if Survival='Y' then 1;&lt;/P&gt;
&lt;P&gt;use:&lt;/P&gt;
&lt;P&gt;if Survival='N' then SurvivalNum=0;&lt;BR /&gt;if Survival='Y' then SurvivalNum=1;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 20:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generating-standard-deviation-from-PROC-FREQ-out-put/m-p/457059#M115857</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-24T20:41:42Z</dc:date>
    </item>
  </channel>
</rss>

