<?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: Missing values in datasets: Due to proc transpose in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/607108#M8388</link>
    <description>&lt;P&gt;Why do you put the idchem1 thru idchem4 values in quotes when they're numeric variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when you try to create the dataset amot, you set the wrong filename. It should have been:&amp;nbsp;set idnew1b&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Nov 2019 20:07:42 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2019-11-25T20:07:42Z</dc:date>
    <item>
      <title>Missing values in datasets: Due to proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/607102#M8387</link>
      <description>&lt;P&gt;I would appreciate if someone could explain this to me and provide me the the right code to &lt;BR /&gt;resolve this problem:&lt;BR /&gt;I have a smaller dataset with 17 obs. I transposed and found exposed(1) and unexposed(0) variables and found&lt;BR /&gt;an association between them. The resulting data was 8 obs but with dots(.) ie. missing values but&lt;BR /&gt;proc freq did not display or used the missing values in the computations even if I don't use the&lt;BR /&gt;/missing or /missprint options.(Results attached,please).&lt;BR /&gt;However, when I apply the same code for the larger dataset(over 100,000 obs), the dots(.) were displayed&lt;BR /&gt;and missing values in thousands were indicated in the proc freq results(not shown).&lt;BR /&gt;II want to understand why no missing data were indicated in the proc freq for the smaller dataset (even though it had dots(.)&lt;BR /&gt;like the larger dataset.&lt;BR /&gt;May I know the code to remove the dots(.) to blanks (ie. nothing) so that SAS will not show any missing value &lt;BR /&gt;like in the case of the smaller dataset. &lt;BR /&gt;Thanks.&lt;/P&gt;
&lt;PRE&gt;data idnew1;&lt;BR /&gt;input id$ job idchem;&lt;BR /&gt;datalines;&lt;BR /&gt;os1 1 990005&lt;BR /&gt;os1 1 990021&lt;BR /&gt;os1 1 211700&lt;BR /&gt;os1 2 211700&lt;BR /&gt;os1 2 990021&lt;BR /&gt;os1 2 210701&lt;BR /&gt;os1 2 990005&lt;BR /&gt;os2 1 210701&lt;BR /&gt;os2 1 990005&lt;BR /&gt;os2 2 990021&lt;BR /&gt;os2 3 210701&lt;BR /&gt;os2 3 990005&lt;BR /&gt;os3 3 210701&lt;BR /&gt;os3 1 211700&lt;BR /&gt;os4 1 210701&lt;BR /&gt;os4 1 990005&lt;BR /&gt;os4 1 211700&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*TRANSPOSING VARIABLES*/&lt;BR /&gt;proc sort data=idnew1; by id job;&lt;BR /&gt;proc transpose data=idnew1 out=idnew1b prefix=idchem;&lt;BR /&gt;by id job;&lt;BR /&gt;/*id job;*/&lt;BR /&gt;var idchem;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/*Cla exposure*/&lt;BR /&gt;data clat; &lt;BR /&gt;set idnew1b; &lt;BR /&gt;if idchem1='990005'or idchem2='990005' or idchem3='990005' or idchem4='990005' then cla_exp=1; &lt;BR /&gt;else cla_exp=0;&lt;BR /&gt;id_job=catx('_', id, job); &lt;BR /&gt;put _all_; &lt;BR /&gt;drop _name_;&lt;BR /&gt;run; &lt;BR /&gt;proc print data=clat;&lt;BR /&gt;Title "Cla exposure";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/*Bio exposure*/&lt;BR /&gt;data biot; &lt;BR /&gt;set idnew1b; &lt;BR /&gt;if idchem1='990021' or idchem2='990021' or idchem3='990021' or idchem4='990021' then bio_exp=1; &lt;BR /&gt;else bio_exp=0;&lt;BR /&gt;id_job=catx('_', id, job); &lt;BR /&gt;put _all_;&lt;BR /&gt;drop _name_; &lt;BR /&gt;run; &lt;BR /&gt;Title "Bio exposure";&lt;BR /&gt;proc print data=biot;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/*Amo exposure*/&lt;BR /&gt;data amot; &lt;BR /&gt;set idnew1mb; &lt;BR /&gt;if idchem1='210701' or idchem2='210701' or idchem3='210701' or idchem4='210701' then amo_exp=1; &lt;BR /&gt;else amo_exp=0;&lt;BR /&gt;id_job=catx('_', id, job); &lt;BR /&gt;put _all_;&lt;BR /&gt;drop _name_; &lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;proc print data=amot;&lt;BR /&gt;Title "Amo exposure";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*Chl exposure*/&lt;BR /&gt;data chlt; &lt;BR /&gt;set idnew1b; &lt;BR /&gt;if idchem1='211700' or idchem2='211700' or idchem3='211700'or idchem4='211700' then chl_exp=1; &lt;BR /&gt;else chl_exp=0;&lt;BR /&gt;id_job=catx('_', id, job); &lt;BR /&gt;put _all_; &lt;BR /&gt;drop _name_;&lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;proc print data=chlt;&lt;BR /&gt;Title "chl exposure";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/* Merging clat,biot and amot files*/&lt;BR /&gt;data mlt; merge clat biot amot chlt;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc print data=mlt;&lt;BR /&gt;Title "Merged exposure files for cla ,bio, amo and chl pollutants";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*CROSS ASSOCIATIONS:clat,biot,amot,chlt*/&lt;BR /&gt;proc freq data=mlt;&lt;BR /&gt;tables cla_exp*bio_exp;&lt;BR /&gt;tables cla_exp*amo_exp;&lt;BR /&gt;tables cla_exp*chl_exp;&lt;BR /&gt;tables bio_exp*cla_exp;&lt;BR /&gt;tables bio_exp*amo_exp;&lt;BR /&gt;tables bio_exp*chl_exp;&lt;BR /&gt;run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Nov 2019 19:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/607102#M8387</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-25T19:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Missing values in datasets: Due to proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/607108#M8388</link>
      <description>&lt;P&gt;Why do you put the idchem1 thru idchem4 values in quotes when they're numeric variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when you try to create the dataset amot, you set the wrong filename. It should have been:&amp;nbsp;set idnew1b&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 20:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/607108#M8388</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2019-11-25T20:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Missing values in datasets: Due to proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/607200#M8392</link>
      <description>&lt;P&gt;You can use option missing in proc freq to treat missing values as a valid level. Here is how it could be done:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data idnew1;
input id$ job idchem;
datalines;
os1 1 990005
os1 1 990021
os1 1 211700
os1 2 211700
os1 2 990021
os1 2 210701
os1 2 990005
os2 1 210701
os2 1 990005
os2 2 990021
os2 3 210701
os2 3 990005
os3 3 210701
os3 1 211700
os4 1 210701
os4 1 990005
os4 1 211700
;

proc format;
value idchem
990005 = "cla_exp"
990021 = "bio_exp"
210701 = "amo_exp"
211700 = "chl_exp";
run;

data temp;
set idnew1;
dum = 1;
format idchem idchem.;
run;

proc sort data=temp; by id job idchem; run;

proc transpose data=temp out=idnew2(drop=_name_);
by id job;
id idchem;
var dum;
run;

proc freq data=idnew2;
tables 
	cla_exp*bio_exp 
	cla_exp*amo_exp 
	cla_exp*chl_exp 
	bio_exp*amo_exp
	bio_exp*chl_exp
	amo_exp*chl_exp / missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Nov 2019 05:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/607200#M8392</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-11-26T05:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Missing values in datasets: Due to proc transpose</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/608185#M8421</link>
      <description>Perfect! It works! Thanks very much!</description>
      <pubDate>Fri, 29 Nov 2019 08:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Missing-values-in-datasets-Due-to-proc-transpose/m-p/608185#M8421</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-29T08:06:07Z</dc:date>
    </item>
  </channel>
</rss>

