<?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: Retain values for evalution throughout the dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157121#M41198</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will populate missing values in ex dataset to have mean and standard deviation for every observation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc stdize data=imp.ex out=want reponly method=median;&lt;BR /&gt;var m: s: ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=want;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Aug 2014 22:11:02 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2014-08-11T22:11:02Z</dc:date>
    <item>
      <title>Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157118#M41195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have the follow question referring to the attached dataset. Basically, I want to normalize variables (Xtest_1 to Xtest8). using their respective (mean1 to mean8) and (std1-std8). &lt;/P&gt;&lt;P&gt;I know I can use IML for vector manipulation, but if I choose to use dataset to do this. How to proceed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question1:&lt;/P&gt;&lt;P&gt;I manage to "&lt;STRONG&gt;gather&lt;/STRONG&gt;" the (mean1 to mean8) and (std1-std8) with variables (Xtest_1 to Xtest8) under the same dataset, see attached file. &lt;/P&gt;&lt;P&gt;I tried to use following code to populate Normalize array, but it produce only 1 obs, because (mean1-mean8) and (std1-std8) are missing for the rest of obs.&lt;/P&gt;&lt;P&gt;Maybe: how can I declare them constants such I can refer to them as SAS sweeps through the dataset?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question2:&lt;/P&gt;&lt;P&gt;Or, take one-step back before "&lt;STRONG&gt;gather&lt;/STRONG&gt;" the statistics, how can I use the means(mean1-mean8) and standard deviation(std1-std8) produced by PROC MEANS. I still cannot figure out how to "apply" the output statistics from PROC MEANS on other dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;DATA New_ex;&lt;/P&gt;&lt;P&gt;SET ex;&lt;/P&gt;&lt;P&gt;RETAIN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mean1-mean8;&lt;/P&gt;&lt;P&gt;RETAIN&amp;nbsp; std1-std8;&lt;/P&gt;&lt;P&gt;ARRAY MeanStat[8] mean1-mean8;&lt;/P&gt;&lt;P&gt;ARRAY StdStat[8] std1-std8;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARRAY X&lt;LI&gt; Xtest_1-Xtest_8;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARRAY Normal[8] Normal1-Normal8 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO i = 1 to 8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Normal&lt;I&gt;=(X&lt;I&gt;-MeanStat&lt;I&gt;)/StdStat&lt;I&gt;;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OUTPUT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 18:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157118#M41195</guid>
      <dc:creator>Elvin</dc:creator>
      <dc:date>2014-08-11T18:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157119#M41196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's a proc for that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC STANDARD&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;PROC STDIZE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 18:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157119#M41196</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-08-11T18:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157120#M41197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Reeza notes, you may find it easier to use an existing procedure for this particular problem.&amp;nbsp; Just for the record, though, there is an easy DATA step technique to combine a one-observation data set (your means and standard deviations) with a many-observation data set (your original line-by-line values):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if _n_=1 then set one_observation;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set many_observations;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; *** array processing, no retain needed;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variables that come in from a SAS data set are automatically retained.&amp;nbsp; The trick is to keep the DATA step going instead of having it end prematurely.&amp;nbsp; That's why there's an IF/THEN statement.&amp;nbsp; Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 18:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157120#M41197</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-08-11T18:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157121#M41198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will populate missing values in ex dataset to have mean and standard deviation for every observation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc stdize data=imp.ex out=want reponly method=median;&lt;BR /&gt;var m: s: ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=want;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 22:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157121#M41198</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-08-11T22:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157122#M41199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am aware of the PROC STANDARD, wihich takes only 1 mu and 1 sigma a time, applying on the many-observation dataset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here my situation is: the variables (Xtest_1-Xtest_8), all residing in one dataset, each should be normalized by their respective mean and std. PROC STANDARD won't work, unless I split the dataset into 8 individual dataset. (ie, dataset1 has only Xtest_1, dataset2 has only Xtest_2, ...etc) , then use PROC STANDARD on each of them. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 22:19:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157122#M41199</guid>
      <dc:creator>Elvin</dc:creator>
      <dc:date>2014-08-11T22:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157123#M41200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I was looking to fill the missing value before, using an ad-hoc approach. This makes it easier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 22:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157123#M41200</guid>
      <dc:creator>Elvin</dc:creator>
      <dc:date>2014-08-11T22:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157124#M41201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Proc STDIZE will though and calculates the mean/std as well &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc stdize data=sashelp.class out=check;&lt;/P&gt;&lt;P&gt;var weight height age;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 22:46:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157124#M41201</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-08-11T22:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157125#M41202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just found out a much easier way to standardize (xtest_1-xtest_8), using PROC STDIZE.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Given:&lt;/P&gt;&lt;P&gt;1) The statistics means(mean1-mean8) and standard deviation(std1-std8)&amp;nbsp; [produced by output dataset of PROC MEANS] reside in&amp;nbsp; 'one-observation' dataset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) variable Xtest1_Xtest_8 resides in 'many-observation' dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can standardized variables (Xtest1_Xtest_8) according to their mean and std using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC STDIZE DATA="many-observation dataset" OUT=Want PSTAT METHOD=IN("one-observation datase"); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR&amp;nbsp; Xtest_1-Xtest_8;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOCATION&amp;nbsp; mean1-mean8 ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCALE std1-std8 ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 19:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157125#M41202</guid>
      <dc:creator>Elvin</dc:creator>
      <dc:date>2014-08-12T19:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157126#M41203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The default method is STD, which automatically sets the location to be the mean and scale to be the standard deviation. &lt;/P&gt;&lt;P&gt;Don't work too hard &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;This should give you the same results.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC STDIZE DATA="many-observation dataset" OUT=Want PSTAT ; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR&amp;nbsp; Xtest_1-Xtest_8;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 19:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157126#M41203</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-08-12T19:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Retain values for evalution throughout the dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157127#M41204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see your point. But, in my case, means(mean1-mean8) and standard deviation(std1-std8) are not generated from (Xtest_1-Xtest_8). They are computed based on other dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 22:56:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-values-for-evalution-throughout-the-dataset/m-p/157127#M41204</guid>
      <dc:creator>Elvin</dc:creator>
      <dc:date>2014-08-12T22:56:41Z</dc:date>
    </item>
  </channel>
</rss>

