<?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: PCA with proc princomp in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384024#M19969</link>
    <description>&lt;P&gt;Thanks Warren,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sorry , I don't understand what you are doing with freq.&lt;/P&gt;
&lt;P&gt;My problem is to work with the pca vars in the test dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can explain in more details...I will be grateful&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 29 Jul 2017 21:56:26 GMT</pubDate>
    <dc:creator>juanvg1972</dc:creator>
    <dc:date>2017-07-29T21:56:26Z</dc:date>
    <item>
      <title>PCA with proc princomp</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384017#M19967</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using proc princomp to reduce number of vars in a model.I don't have previous experience with PCA I have a simple question:&lt;/P&gt;
&lt;P&gt;Using proc princomps I get the eigenvalues and the coefficients that relate its with raw vars.&lt;/P&gt;
&lt;P&gt;I have 30 raw vars and using PCA I can reduce to 7 pca vars (eigenvalues) that keep 95% of datasets variance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to work with this 7pca vars in my model, but now I have a doubt:&lt;/P&gt;
&lt;P&gt;Once created the model with the 7 pca vars I want to validate this model with a test dataset. How I get the 7 pca vars in my test datasets?, do I have to use the coefficients obtained in the proc princomp to calculate the 7 pca vars of the test dataset and then apply the model?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any advice will be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2017 21:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384017#M19967</guid>
      <dc:creator>juanvg1972</dc:creator>
      <dc:date>2017-07-29T21:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: PCA with proc princomp</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384022#M19968</link>
      <description>&lt;P&gt;The easiest way to get scores on additional observations is to create one data set and give the active observations a freq of 1 and the passive observations that you want scored a freq of 0. &amp;nbsp;This example illustrates.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data iris;
  set sashelp.iris;
  f = species ne 'Virginica';
  run;

proc princomp out=scores;
   freq f;
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Jul 2017 21:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384022#M19968</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-07-29T21:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: PCA with proc princomp</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384024#M19969</link>
      <description>&lt;P&gt;Thanks Warren,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sorry , I don't understand what you are doing with freq.&lt;/P&gt;
&lt;P&gt;My problem is to work with the pca vars in the test dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can explain in more details...I will be grateful&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2017 21:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384024#M19969</guid>
      <dc:creator>juanvg1972</dc:creator>
      <dc:date>2017-07-29T21:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: PCA with proc princomp</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384027#M19970</link>
      <description>&lt;P&gt;Imagine you have two data sets. You want to fit a model on iris and get scores on test. So you concatenate them and make a frequency variable f, that has values of 1 for the observations that you want to use to fit the model and 0 for the passive observations you want to score. &amp;nbsp;My first two steps make an analysis and test data set from the iris data. &amp;nbsp;The third concatenates them and creates the frequency variable. &amp;nbsp;Then you have a data set like I showed you in my first post. &amp;nbsp;Look at the proc print results to see how this works.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;data iris;
  set sashelp.iris;
  if species ne 'Virginica';
  run;
data test;
  set sashelp.iris;
  if species eq 'Virginica';
  run;

data all;
   set iris(in=i) test;
   f = i;
   run;

proc print; run;

proc princomp out=scores;
   freq f;
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Jul 2017 22:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384027#M19970</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-07-29T22:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: PCA with proc princomp</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384028#M19971</link>
      <description>&lt;P&gt;Now I undesrtanf. Thanks!!!&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2017 22:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384028#M19971</guid>
      <dc:creator>juanvg1972</dc:creator>
      <dc:date>2017-07-29T22:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: PCA with proc princomp</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384252#M19985</link>
      <description>&lt;P&gt;There is a PROC VARCLUS &amp;nbsp;you used to reduce the number of variables.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 13:01:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PCA-with-proc-princomp/m-p/384252#M19985</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-07-31T13:01:01Z</dc:date>
    </item>
  </channel>
</rss>

