<?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: I want to save the mean of variable x1 as a variable outside of DATA STEP. And type it into anot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712144#M219484</link>
    <description>&lt;P&gt;This is possible to do the way you describe. However, I wonder if there is a better way. Is your goal to standardize data, i.e.&amp;nbsp;&lt;SPAN&gt;subtract the mean of a variable and divide by the variable's standard deviation? If so, there are better ways.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For example, see the article&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://blogs.sas.com/content/iml/2020/08/10/standardize-data-sas.html" target="_self"&gt;4 ways to standardize data in SAS&lt;/A&gt; by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2021 16:07:43 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-01-18T16:07:43Z</dc:date>
    <item>
      <title>I want to save the mean of variable x1 as a variable outside of DATA STEP. And type it into another</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712142#M219482</link>
      <description>&lt;P&gt;Its is possible extract "means "and "std" from another data step and make it a solid value than I can paste in PROC STANDARD? Here is my unfinished example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;data what_i_have;
input x1 x2 x3;
cards;
1 2 3
4 5 6
7 8 9
;
run;
proc means data=what_i_have mean std;
output out=mean_x1 mean= std= /autoname;
run;

proc standard data=what_i_have out=what_i_want  mean = "here i want paste my mean from choosen variable" std= "here i want paste my std ";
var x1 */ I want here iterate through every variable */;
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The best&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 16:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712142#M219482</guid>
      <dc:creator>x3d1m4</dc:creator>
      <dc:date>2021-01-18T16:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: I want to save the mean of variable x1 as a variable outside of DATA STEP. And type it into anot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712144#M219484</link>
      <description>&lt;P&gt;This is possible to do the way you describe. However, I wonder if there is a better way. Is your goal to standardize data, i.e.&amp;nbsp;&lt;SPAN&gt;subtract the mean of a variable and divide by the variable's standard deviation? If so, there are better ways.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For example, see the article&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://blogs.sas.com/content/iml/2020/08/10/standardize-data-sas.html" target="_self"&gt;4 ways to standardize data in SAS&lt;/A&gt; by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 16:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712144#M219484</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-18T16:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: I want to save the mean of variable x1 as a variable outside of DATA STEP. And type it into anot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712154#M219489</link>
      <description>&lt;P&gt;Here's one way.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC STDIZE will also standardize variables and calculate the mean/standard deviation as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/364476"&gt;@x3d1m4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Its is possible extract "means "and "std" from another data step and make it a solid value than I can paste in PROC STANDARD? Here is my unfinished example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data what_i_have;
input x1 x2 x3;
cards;
1 2 3
4 5 6
7 8 9
;
run;
proc means data=what_i_have mean std;
output out=mean_x1 mean= std= /autoname;
run;

proc standard data=what_i_have out=what_i_want  mean = "here i want paste my mean from choosen variable" std= "here i want paste my std ";
var x1 */ I want here iterate through every variable */;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 16:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712154#M219489</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-18T16:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: I want to save the mean of variable x1 as a variable outside of DATA STEP. And type it into anot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712211#M219525</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/364476"&gt;@x3d1m4&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Its is possible extract "means "and "std" from another data step and make it a solid value than I can paste in PROC STANDARD? Here is my unfinished example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data what_i_have;
input x1 x2 x3;
cards;
1 2 3
4 5 6
7 8 9
;
run;
proc means data=what_i_have mean std;
output out=mean_x1 mean= std= /autoname;
run;

proc standard data=what_i_have out=what_i_want  mean = "here i want paste my mean from choosen variable" std= "here i want paste my std ";
var x1 */ I want here iterate through every variable */;
run;&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_stdize_overview.htm&amp;amp;locale=en" target="_self"&gt;PROC STDIZE&lt;/A&gt; will do this for you without the PROC MEANS step and without you having to paste anything, and it will do it for every variable with one call to the PROC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize data=what_i_have method=std out=what_i_want;
    var x1 x2 x3;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Jan 2021 19:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712211#M219525</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-18T19:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: I want to save the mean of variable x1 as a variable outside of DATA STEP. And type it into anot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712636#M219748</link>
      <description>Use Proc sql to extract mean and std here is an exaple: &lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;SELECT AVG(Variable) &lt;BR /&gt;INTO: M&lt;BR /&gt;FROM Dataset_Name;&lt;BR /&gt;SELECT STD(Variable) &lt;BR /&gt;INTO: S&lt;BR /&gt;FROM Dataset_Name;&lt;BR /&gt;QUIT;&lt;BR /&gt;RUN;&lt;BR /&gt;----------------------------------------- CREATE NEW VARIABLES-----------------------------&lt;BR /&gt;DATA what_i_have;&lt;BR /&gt;SET what_i_have;&lt;BR /&gt;M=&amp;amp;M;&lt;BR /&gt;S=&amp;amp;S;&lt;BR /&gt;RUN;&lt;BR /&gt;------------------------------------PUT INTO PROC STANDARD----------------------------------&lt;BR /&gt;proc standard data=what_i_have out=what_i_want  mean = M std= S;&lt;BR /&gt;var x1 */ I want here iterate through every variable */;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jan 2021 12:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-save-the-mean-of-variable-x1-as-a-variable-outside-of/m-p/712636#M219748</guid>
      <dc:creator>SurajSaini</dc:creator>
      <dc:date>2021-01-20T12:06:24Z</dc:date>
    </item>
  </channel>
</rss>

