<?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: Standardizing observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361655#M85333</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lower = 1.61;
%let upper = 3.14;
%let range = %sysevalf(&amp;amp;upper - &amp;amp;lower);
proc stdize data=sample out=sample6 method=RANGE mult=&amp;amp;range add=&amp;amp;lower;
   var Value;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 25 May 2017 15:29:02 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2017-05-25T15:29:02Z</dc:date>
    <item>
      <title>Standardizing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361481#M85255</link>
      <description>&lt;P&gt;I want to standardize the variable titled "Value" such that it has a maximum value of X (e.g., -2) and a minimum value of Y (e.g., 10). To do so, I want that all observations are adjusted in the same way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see below the code I have written so far and it is based on a post by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;(please see link below):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA work.sample;
	INPUT Institution $ Value;
	DATALINES; 
	ABC 0.8 
	BCD 0.9 
	CDF 1.2 
	DEF -0.1
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Normalize the data above to a max of 1 and min of 0 such that all other observations (non-max and non-min values) will also change;

proc stdize data=work.sample out=work.sample2 method=RANGE;
   var Value;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*To change to a different range (e.g., [-1,1])*/&lt;BR /&gt;data work.sample3;
	set work.sample2;
	Value = 2*Value - 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;U&gt;&lt;STRONG&gt;Question 1:&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;BR /&gt;By adjusting the range, all of the non-boundary values will also be adjusted, right? For instance, if we have 3 observations (e.g., -10, 5, 10), then the median will also change such that it incorporates the adjustment of the upper and lower boundary (which changes to 0 and 1, respectively).&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;U&gt;&lt;STRONG&gt;Question 2:&lt;/STRONG&gt; &lt;/U&gt;&lt;/FONT&gt;&lt;BR /&gt;If I want to have an upper bound of 10 and a lower bound of 2 what change do I have to make in the last part of the code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&lt;FONT color="#800080"&gt;Link:&lt;/FONT&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/scaling-variable-in-a-dataset/td-p/13294" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/scaling-variable-in-a-dataset/td-p/13294&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 05:39:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361481#M85255</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-25T05:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Standardizing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361611#M85319</link>
      <description>&lt;P&gt;Q1: Correct.&lt;/P&gt;
&lt;P&gt;Q2: You can use the MULT= and ADD= options to scale and translate directly in PROC STDIZE. So insted of STDIZE followed by a DATA step, you can get sample3 by using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize data=work.sample out=work.sample4 method=RANGE mult=2 add=-1;
   var Value;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In particular, if you want an&amp;nbsp;&lt;SPAN&gt;upper bound of 10 and a lower bound of 2, then the scale of the data is (10-2)=8 and the offset is 2, so you can use&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize data=work.sample out=work.sample5 method=RANGE mult=8 add=2;
   var Value;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 May 2017 14:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361611#M85319</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-05-25T14:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Standardizing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361651#M85329</link>
      <description>&lt;P&gt;Perfect, thank you for this helpful reply. Lastly, I am wondering if there is any way to use "proc stdize" such that one can directly specify the upper and lower bound without having to add / subtract or multiply / divide values. For instance, if one wants to have a lower bound of 1.61 and an upper bound of 3.14,&amp;nbsp;would it be possibly to directly specify these bounds?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 15:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361651#M85329</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-25T15:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Standardizing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361655#M85333</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lower = 1.61;
%let upper = 3.14;
%let range = %sysevalf(&amp;amp;upper - &amp;amp;lower);
proc stdize data=sample out=sample6 method=RANGE mult=&amp;amp;range add=&amp;amp;lower;
   var Value;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 May 2017 15:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361655#M85333</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-05-25T15:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Standardizing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361660#M85337</link>
      <description>&lt;P&gt;This is exactly what I needed! Thank you very much,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 15:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Standardizing-observations/m-p/361660#M85337</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-25T15:37:04Z</dc:date>
    </item>
  </channel>
</rss>

