<?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: Cross association between exposures: Another method without proc transpose? in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607079#M8385</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190754"&gt;@ak2011&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No problem&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can drop the I variable which is no more used in the drop statement as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drop idchem_list list1-list&amp;amp;count_idchem; /*line 97*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and also put &amp;nbsp;&amp;amp;count_idchem line 82 instead of 4. This macro variable is created during the first step (proc sql)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; array flag(&amp;amp;count_idchem) $ _temporary_;&amp;nbsp;/*line 82*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Nov 2019 18:22:15 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2019-11-25T18:22:15Z</dc:date>
    <item>
      <title>Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/606914#M8374</link>
      <description>&lt;PRE&gt;Hi,&lt;BR /&gt;Could someone help me with the SAS code to find associations(ie. cross tabulations) &lt;BR /&gt;between exposed variables? Exposed(exp=1), unexposed=0. Actually, I have a dataset with &lt;STRONG&gt;30 idchems (over 100,000 obs in total)&lt;/STRONG&gt; but I am using only&lt;BR /&gt;&lt;STRONG&gt;4 of them&lt;/STRONG&gt; as a test to see if the method will work. I used proc transpose to read the idchems as &lt;BR /&gt;idchem1=990005........... idchem4=211700 and finally found the cross tabulations using proc freq&lt;BR /&gt;shown in the SAS output. Proc transpose worked well with the test dataset and I was able to find&lt;BR /&gt;the associations(cross tabulations) as shown in output(attached). Proc transpose for the larger dataset&lt;BR /&gt;was a problem; SAS couldn't transpose and display all the dataset for the 30 idchems; &lt;BR /&gt;it transposed and displayed a dataset having only 4 idchems. Could someone help me with a SAS code&lt;BR /&gt;for another method without the proc transpose or even if with a proc transpose a shorter datastep ie.&lt;BR /&gt;one that incorporates the dataset with 30 idchems at a time.&lt;BR /&gt;In summary, a SAS code/method that will help me eventually to find the cross associations for the exposed(1)&lt;BR /&gt;and unexposed(0) other than the method I used, which of course will not be very efficient for the larger&lt;BR /&gt;data with 30 idchems. SAS code used is found below and results is attached.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt; &lt;BR /&gt;ak.&lt;BR /&gt;&lt;BR /&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;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 idnew1b; &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;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;73 data idnew1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 input id$ job idchem;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 datalines;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.IDNEW1 has 17 observations and 3 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;93 ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;94 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;95&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;96 /*TRANSPOSING VARIABLES*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;97 proc sort data=idnew1; by id job;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 17 observations read from the data set WORK.IDNEW1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.IDNEW1 has 17 observations and 3 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.03 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;98 proc transpose data=idnew1 out=idnew1b prefix=idchem;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;99 by id job;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;100 /*id job;*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;101 var idchem;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;102 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 17 observations read from the data set WORK.IDNEW1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.IDNEW1B has 8 observations and 7 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.06 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;103&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;104 /*Cla exposure*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;105 data clat;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;106 set idnew1b;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;107 if idchem1='990005' or idchem2='990005' or idchem3='990005' or idchem4='990005' then cla_exp=1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;108 else cla_exp=0;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;109 id_job=catx('_', id, job);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;110 put _all_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;111 drop _name_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;112 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;107:12 107:32 107:52 107:72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=1 _NAME_=idchem idchem1=990005 idchem2=990021 idchem3=211700 idchem4=. cla_exp=1 id_job=os1_1 _ERROR_=0 _N_=1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=2 _NAME_=idchem idchem1=211700 idchem2=990021 idchem3=210701 idchem4=990005 cla_exp=1 id_job=os1_2 _ERROR_=0 _N_=2&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. cla_exp=1 id_job=os2_1 _ERROR_=0 _N_=3&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=2 _NAME_=idchem idchem1=990021 idchem2=. idchem3=. idchem4=. cla_exp=0 id_job=os2_2 _ERROR_=0 _N_=4&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=3 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. cla_exp=1 id_job=os2_3 _ERROR_=0 _N_=5&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=1 _NAME_=idchem idchem1=211700 idchem2=. idchem3=. idchem4=. cla_exp=0 id_job=os3_1 _ERROR_=0 _N_=6&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=3 _NAME_=idchem idchem1=210701 idchem2=. idchem3=. idchem4=. cla_exp=0 id_job=os3_3 _ERROR_=0 _N_=7&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os4 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=211700 idchem4=. cla_exp=1 id_job=os4_1 _ERROR_=0 _N_=8&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.IDNEW1B.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.CLAT has 8 observations and 8 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.03 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;113 proc print data=clat;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;114 Title "Cla exposure";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;115 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.CLAT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.20 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.17 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;116&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;117 /*Bio exposure*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;118 data biot;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;119 set idnew1b;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;120 if idchem1='990021' or idchem2='990021' or idchem3='990021' or idchem4='990021' then bio_exp=1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;121 else bio_exp=0;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;122 id_job=catx('_', id, job);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;123 put _all_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;124 drop _name_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;125 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;120:12 120:32 120:52 120:72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=1 _NAME_=idchem idchem1=990005 idchem2=990021 idchem3=211700 idchem4=. bio_exp=1 id_job=os1_1 _ERROR_=0 _N_=1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=2 _NAME_=idchem idchem1=211700 idchem2=990021 idchem3=210701 idchem4=990005 bio_exp=1 id_job=os1_2 _ERROR_=0 _N_=2&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. bio_exp=0 id_job=os2_1 _ERROR_=0 _N_=3&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=2 _NAME_=idchem idchem1=990021 idchem2=. idchem3=. idchem4=. bio_exp=1 id_job=os2_2 _ERROR_=0 _N_=4&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=3 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. bio_exp=0 id_job=os2_3 _ERROR_=0 _N_=5&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=1 _NAME_=idchem idchem1=211700 idchem2=. idchem3=. idchem4=. bio_exp=0 id_job=os3_1 _ERROR_=0 _N_=6&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=3 _NAME_=idchem idchem1=210701 idchem2=. idchem3=. idchem4=. bio_exp=0 id_job=os3_3 _ERROR_=0 _N_=7&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os4 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=211700 idchem4=. bio_exp=0 id_job=os4_1 _ERROR_=0 _N_=8&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.IDNEW1B.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.BIOT has 8 observations and 8 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;126 Title "Bio exposure";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;127 proc print data=biot;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;128&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;129 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.BIOT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.24 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.24 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;130&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;131 /*Amo exposure*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;132 data amot;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;133 set idnew1b;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;134 if idchem1='210701' or idchem2='210701' or idchem3='210701' or idchem4='210701' then amo_exp=1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;135 else amo_exp=0;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;136 id_job=catx('_', id, job);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;137 put _all_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;138 drop _name_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;139 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;134:12 134:32 134:52 134:72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=1 _NAME_=idchem idchem1=990005 idchem2=990021 idchem3=211700 idchem4=. amo_exp=0 id_job=os1_1 _ERROR_=0 _N_=1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=2 _NAME_=idchem idchem1=211700 idchem2=990021 idchem3=210701 idchem4=990005 amo_exp=1 id_job=os1_2 _ERROR_=0 _N_=2&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. amo_exp=1 id_job=os2_1 _ERROR_=0 _N_=3&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=2 _NAME_=idchem idchem1=990021 idchem2=. idchem3=. idchem4=. amo_exp=0 id_job=os2_2 _ERROR_=0 _N_=4&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=3 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. amo_exp=1 id_job=os2_3 _ERROR_=0 _N_=5&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=1 _NAME_=idchem idchem1=211700 idchem2=. idchem3=. idchem4=. amo_exp=0 id_job=os3_1 _ERROR_=0 _N_=6&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=3 _NAME_=idchem idchem1=210701 idchem2=. idchem3=. idchem4=. amo_exp=1 id_job=os3_3 _ERROR_=0 _N_=7&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os4 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=211700 idchem4=. amo_exp=1 id_job=os4_1 _ERROR_=0 _N_=8&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.IDNEW1B.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.AMOT has 8 observations and 8 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;140&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;141 proc print data=amot;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;142 Title "Amo exposure";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;143 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.AMOT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.12 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.13 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;144&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;145&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;146 /*Chl exposure*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;147 data chlt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;148 set idnew1b;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;149 if idchem1='211700' or idchem2='211700' or idchem3='211700'or idchem4='211700' then chl_exp=1;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;________&lt;/DIV&gt;&lt;DIV class="sasError"&gt;49&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;between a quoted string and the succeeding identifier is recommended.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;150 else chl_exp=0;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;151 id_job=catx('_', id, job);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;152 put _all_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;153 drop _name_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;154 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;149:12 149:32 149:52 149:71&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=1 _NAME_=idchem idchem1=990005 idchem2=990021 idchem3=211700 idchem4=. chl_exp=1 id_job=os1_1 _ERROR_=0 _N_=1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os1 job=2 _NAME_=idchem idchem1=211700 idchem2=990021 idchem3=210701 idchem4=990005 chl_exp=1 id_job=os1_2 _ERROR_=0 _N_=2&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. chl_exp=0 id_job=os2_1 _ERROR_=0 _N_=3&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=2 _NAME_=idchem idchem1=990021 idchem2=. idchem3=. idchem4=. chl_exp=0 id_job=os2_2 _ERROR_=0 _N_=4&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os2 job=3 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=. idchem4=. chl_exp=0 id_job=os2_3 _ERROR_=0 _N_=5&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=1 _NAME_=idchem idchem1=211700 idchem2=. idchem3=. idchem4=. chl_exp=1 id_job=os3_1 _ERROR_=0 _N_=6&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os3 job=3 _NAME_=idchem idchem1=210701 idchem2=. idchem3=. idchem4=. chl_exp=0 id_job=os3_3 _ERROR_=0 _N_=7&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;id=os4 job=1 _NAME_=idchem idchem1=210701 idchem2=990005 idchem3=211700 idchem4=. chl_exp=1 id_job=os4_1 _ERROR_=0 _N_=8&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.IDNEW1B.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.CHLT has 8 observations and 8 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;155&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;156 proc print data=chlt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;157 Title "chl exposure";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;158 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.CHLT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.19 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.20 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;159&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;160 /* Merging clat,biot and amot files*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;161 data mlt; merge clat biot amot chlt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;162&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;163 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.CLAT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.BIOT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.AMOT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.CHLT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.MLT has 8 observations and 11 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;164&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;165 proc print data=mlt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;166 Title "Merged exposure files for cla ,bio, amo and chl pollutants";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;167 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.MLT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.16 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.16 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;168&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;169&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;170 /*CROSS ASSOCIATIONS:clat,biot,amot,chlt*/&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;171 proc freq data=mlt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;172 tables cla_exp*bio_exp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;173 tables cla_exp*amo_exp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;174 tables cla_exp*chl_exp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;175 tables bio_exp*cla_exp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;176 tables bio_exp*amo_exp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;177 tables bio_exp*chl_exp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;178 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 8 observations read from the data set WORK.MLT.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE FREQ used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.66 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.58 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;179&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;180&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;181 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;193&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 10:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/606914#M8374</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-25T10:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/606989#M8377</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190754"&gt;@ak2011&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this. Hope this help!&lt;/P&gt;
&lt;P&gt;The only thing to adapt is the decode of idchem variable at the beginning of the program in order to create the corresponding character variable with the flag name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&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;
	id_job=catx('_', id, job);
	length idchem_char $7;
	if 		idchem = 990005 then idchem_char = 'cla_exp';
	else if idchem = 990021 then idchem_char = 'bio_exp';
	else if idchem = 210701 then idchem_char = 'amo_exp';
	else if idchem = 211700 then idchem_char = 'chl_exp'; /* to adapt */
	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
;
run;

/* 1. Generate macrovariables */

	proc sql noprint;
		/* Retrieve the list of distinct idchems (num) in a macrovariable : &amp;amp;list_idchem */
		select distinct idchem into:list_idchem separated by " " from idnew1;
		/* Retrieve the list of distinct idchems (format) in a macrovariable : &amp;amp;list_idchem_char */
		select distinct idchem_char into:list_idchem_char separated by " " from idnew1;
		/* Retrieve the number of distinct idchems in a macrovariable : &amp;amp;count_idchem */
		select count(distinct idchem_char) into:count_idchem trimmed from idnew1;
	quit;

	data _null_;
		length temp $2000;
		temp=cat('"',tranwrd("&amp;amp;list_idchem_char"," ",'" "'),'"');
		call symput('list_idchem_char_q',temp);
	run;

	%put &amp;amp;list_idchem;
	%put &amp;amp;list_idchem_char;
	%put &amp;amp;list_idchem_char_q;
	%put &amp;amp;count_idchem;

/* 2. Transpose data and concatenate idchem */

proc sort data=idnew1;
	by id_job;
run;

data idnew_tr;
	set idnew1;
	
	array flag(4) $ _temporary_;
	by id_job;
	retain flag;

	if first.id_job then do;
		count=0;
		call missing(of flag(*));
	end;
	
	count+1;
	
	do i=1 to dim(flag);
		flag(count)=idchem_char;
	end;
	
	idchem_list = catx(" ", of flag(*));
	if last.id_job then output;
	
	drop count i idchem idchem_char id job;
run;

/* 3. Create flag variables */
data idnew_flag;
	set idnew_tr;
	
	array list(&amp;amp;count_idchem) $ (&amp;amp;list_idchem_char_q);
	array flag(*) &amp;amp;list_idchem_char;
	
	do i=1 to dim(list);
		if indexw(idchem_list, list(i)) &amp;gt; 0 then flag(i) = 1;
		else flag(i)=0;
	end;
	
	drop i idchem_list list1-list&amp;amp;count_idchem;
run;

proc print data=idnew_flag;
run;

/* 3. Generate as many 2x2 tables as combinations */

%macro combi (dataset);

proc sql;
	select count(*) into :nbvar from dictionary.columns where libname='WORK' and memname='IDNEW_FLAG' ;
	select name into :mv1- :mv%cmpres(&amp;amp;nbvar) from dictionary.columns where libname='WORK' and memname='IDNEW_FLAG' ;
quit;
 
%do i=2 %to %eval(&amp;amp;nbvar) ;
	%do j=%eval(&amp;amp;i+1) %to %eval(&amp;amp;nbvar);
 
proc freq data=idnew_flag;
	tables &amp;amp;&amp;amp;mv&amp;amp;i*&amp;amp;&amp;amp;mv&amp;amp;j ;
run;

	%end;
%end;
 
%mend;

%combi ();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 14:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/606989#M8377</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-11-25T14:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/606998#M8378</link>
      <description>&lt;P&gt;I think what you want is one observations per ID/JOB,&amp;nbsp;&amp;nbsp; with N dummy variables (where N is the number of distinct IDCHEM values) over the entire original datal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;proc freq the data set to get a file with N sorted obs, one per IDCHEM.in dataset FREQS&lt;/LI&gt;
&lt;LI&gt;transpose that (very small) FREQS dataset twice
&lt;OL&gt;
&lt;LI&gt;Make an empty data set, (data set DUMMY_VARS) but with the needed varnames DUMMY_210701&amp;nbsp; DUMMY_211700 ...)&lt;/LI&gt;
&lt;LI&gt;Make a single obs data (REF_VALUES) set with the array of observed IDCHEM values.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;Then rerun through the (sorted) original dataset, setting realized dummy vars to 1.&lt;/LI&gt;
&lt;/OL&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
run;

proc sort data=idnew1 out=have;
  by id job;
run;

/* Generate a dataset FREQS of all realised IDCHEM values, in sorted order */
proc freq data=idnew1 noprint;
 tables idchem / out=freqs;
run;


/* Make a template dataset (0 obs) of sorted varnames (dummy_210701 dummy211700 ...)
   corresponding to the IDCHEM values */
proc transpose data=freqs (keep=idchem) out=dummy_vars (drop=_name_ )  prefix=dummy_;
  id idchem;
run;

/* Make a single transposed list of sorted IDCHEM values, for value checking */
proc transpose data=freqs (keep=idchem) out=ref_values (drop=_name_) prefix=_value_;
  var idchem;
run;


data want (drop=_:);
  if _n_=1 then set ref_values;   /* Get array of reference CHEM values */

  do until (last.job);
    set have;
    by id job;
	if 0 then set dummy_vars;      /* Just to establish the DUMMY var names */
	array dummy{*} dummy_: ;
	if first.job then do _i=1 to dim(dummy); dummy{_i}=0; end;
	dummy{whichn(idchem,of _value_:)}=1;
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 15:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/606998#M8378</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-11-25T15:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607050#M8379</link>
      <description>Thanks very much! It works for the smaller dataset. I am trying it on the larger dataset but the only trouble is the idchem_char. Sas generated an error message.  Actually it is not your fault, for the smaller dataset I am used datalines but in the larger one, I am reading directly from a file(not datalines). Can you please help me to resolve the idchem_char problem? The code is founld below:&lt;BR /&gt;1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 72         &lt;BR /&gt; 73               /* MACRO APPROACH*/&lt;BR /&gt; 74         &lt;BR /&gt; 75          data chem1(keep=id job idchem);&lt;BR /&gt; 76          length idchem_char $7;&lt;BR /&gt; 77          set multi.multiworkchempostauto;&lt;BR /&gt; NOTE: Data file MULTI.MULTIWORKCHEMPOSTAUTO.DATA is in a format that is native to another host, or the file encoding does not match &lt;BR /&gt;       the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might &lt;BR /&gt;       reduce performance.&lt;BR /&gt; 78         /*input id$ job idchem;*/&lt;BR /&gt; 79         /*id_job=catx('_', id, job);*/&lt;BR /&gt; 80         length idchem_char $7;&lt;BR /&gt; 81         if idchem = 990005 then idchem_char = 'cla_exp';&lt;BR /&gt; 82         else if idchem = 990021 then idchem_char = 'bio_exp';&lt;BR /&gt; 83         else if idchem = 520299 then idchem_char = 'ali_exp';&lt;BR /&gt; 84         else if idchem = 420204 then idchem_char = 'iso_exp'; /* to adapt */&lt;BR /&gt; 85         &lt;BR /&gt; 86         else if idchem = 430101 then idchem_char = 'ben_exp';&lt;BR /&gt; 87         else if idchem = 430103 then idchem_char = 'xyl_exp';&lt;BR /&gt; 88         else if idchem = 430102 then idchem_char = 'tol_exp';&lt;BR /&gt; 89         else if idchem = 430104 then idchem_char = 'sty_exp'; /* to adapt */&lt;BR /&gt; 90         &lt;BR /&gt; 91          else if idchem = 460003 then idchem_char = 'sol_exp';&lt;BR /&gt; 92         else if idchem = 220501 then idchem_char = 'for_exp';&lt;BR /&gt; 93         else if idchem = 510004 then idchem_char = 'hyp_exp';&lt;BR /&gt; 94         else if idchem = 210701 then idchem_char = 'amo_exp'; /* to adapt */&lt;BR /&gt; 95         &lt;BR /&gt; 96         &lt;BR /&gt; 97         else if idchem = 211700 then idchem_char = 'chl_exp';&lt;BR /&gt; 98         else if idchem = 410002 then idchem_char = 'cau_exp';&lt;BR /&gt; 99         else if idchem = 411501 then idchem_char = 'pho_exp';&lt;BR /&gt; 100        else if idchem = 420401 then idchem_char = 'ace_exp'; /* to adapt */&lt;BR /&gt; 101        &lt;BR /&gt; 102        else if idchem = 211701 then idchem_char = 'hcl_exp';&lt;BR /&gt; 103        else if idchem = 460004 then idchem_char = 'wpo_exp'; /* to adapt */&lt;BR /&gt; 104        id_job=catx('_', id, job);&lt;BR /&gt; 105        run;&lt;BR /&gt; &lt;BR /&gt; NOTE: There were 124695 observations read from the data set MULTI.MULTIWORKCHEMPOSTAUTO.&lt;BR /&gt; NOTE: The data set WORK.CHEM1 has 124695 observations and 3 variables.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           1.89 seconds&lt;BR /&gt;       cpu time            1.11 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 106        &lt;BR /&gt; 107        /* 1. Generate macrovariables */&lt;BR /&gt; 108        &lt;BR /&gt; 109        &lt;BR /&gt; 109      !  proc sql noprint;&lt;BR /&gt; 110        /* Retrieve the list of distinct idchems (num) in a macrovariable : &amp;amp;list_idchem */&lt;BR /&gt; 111        select distinct idchem into:list_idchem separated by " " from chem1;&lt;BR /&gt; 112        /* Retrieve the list of distinct idchems (format) in a macrovariable : &amp;amp;list_idchem_char */&lt;BR /&gt; 113        select distinct idchem_char into:list_idchem_char separated by " " from chem1;&lt;BR /&gt; ERROR: The following columns were not found in the contributing tables: idchem_char.&lt;BR /&gt; NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt; 114        /* Retrieve the number of distinct idchems in a macrovariable : &amp;amp;count_idchem */&lt;BR /&gt; 115        select count(distinct idchem_char) into:count_idchem trimmed from chem1;&lt;BR /&gt; ERROR: The following columns were not found in the contributing tables: idchem_char.&lt;BR /&gt; 116        quit;&lt;BR /&gt; NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt; NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;       real time           0.17 seconds&lt;BR /&gt;       cpu time            0.23 seconds&lt;BR /&gt;       &lt;BR /&gt; 117        &lt;BR /&gt; 118        &lt;BR /&gt; 119        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 131        &lt;BR /&gt;Thanks. ak.</description>
      <pubDate>Mon, 25 Nov 2019 16:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607050#M8379</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-25T16:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607058#M8380</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190754"&gt;@ak2011&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that you have kept only the following variables on line 75 -&amp;gt;&amp;nbsp;&lt;SPAN&gt;data chem1(keep=id job idchem)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You should add also&amp;nbsp;data idchem_char&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 16:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607058#M8380</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-11-25T16:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607062#M8381</link>
      <description>Thanks. Maybe I did not clarify things well.&lt;BR /&gt;The dummies have been created alright but now I need to find id_job variables and find the associations between say cla_exp * bio_exp, etc using the proc frequency. Now the exposed(1) and unexposed(0) variables have been created but I need to find the associations between them.&lt;BR /&gt;Thanks.&lt;BR /&gt;ak.</description>
      <pubDate>Mon, 25 Nov 2019 17:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607062#M8381</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-25T17:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607071#M8382</link>
      <description>Thanks. A little problem again on flag(count) line 88:&lt;BR /&gt;Can you please check for me?&lt;BR /&gt;&lt;BR /&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 72         &lt;BR /&gt; 73         data idnew_tr;&lt;BR /&gt; 74         set idnew1;&lt;BR /&gt; 75         &lt;BR /&gt; 76         array flag(4) $ _temporary_;&lt;BR /&gt; 77         by id_job;&lt;BR /&gt; 78         retain flag;&lt;BR /&gt; 79         &lt;BR /&gt; 80         if first.id_job then do;&lt;BR /&gt; 81         count=0;&lt;BR /&gt; 82         call missing(of flag(*));&lt;BR /&gt; 83         end;&lt;BR /&gt; 84         &lt;BR /&gt; 85         count+1;&lt;BR /&gt; 86         &lt;BR /&gt; 87         do i=1 to dim(flag);&lt;BR /&gt; 88         flag(count)=idchem_char;&lt;BR /&gt; 89         end;&lt;BR /&gt; 90         &lt;BR /&gt; 91         idchem_list = catx(" ", of flag(*));&lt;BR /&gt; 92         if last.id_job then output;&lt;BR /&gt; 93         &lt;BR /&gt; 94         drop count i idchem idchem_char id job;&lt;BR /&gt; 95         run;&lt;BR /&gt; &lt;BR /&gt; ERROR: Array subscript out of range at line 88 column 3.&lt;BR /&gt; id=OSaa01 job=2 idchem=530196 idchem_char=  id_job=OSaa01_2 FIRST.id_job=0 LAST.id_job=1 count=5 i=1 idchem_list=  _ERROR_=1 _N_=8&lt;BR /&gt; NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt; NOTE: There were 9 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; WARNING: The data set WORK.IDNEW_TR may be incomplete.  When this step was stopped there were 1 observations and 2 variables.&lt;BR /&gt; WARNING: Data set WORK.IDNEW_TR was not replaced because this step was stopped.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           0.01 seconds&lt;BR /&gt;       cpu time            0.01 seconds&lt;BR /&gt;       &lt;BR /&gt;Thanks.&lt;BR /&gt;ak.</description>
      <pubDate>Mon, 25 Nov 2019 17:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607071#M8382</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-25T17:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607074#M8383</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190754"&gt;@ak2011&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems to be a little mistake in the code.&lt;/P&gt;
&lt;P&gt;Please put&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	flag(count)=idchem_char;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	do i=1 to dim(flag);
		flag(count)=idchem_char;
	end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 17:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607074#M8383</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-11-25T17:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607075#M8384</link>
      <description>Sorry for back and forth communication:&lt;BR /&gt;the flag(count) =... did not work. I expect the "count" to be in "blue" like what you sent me but it wasn't like that:&lt;BR /&gt;Please recheck the code below: &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 72         &lt;BR /&gt; 73         /* 2. Transpose data and concatenate idchem */&lt;BR /&gt; 74         &lt;BR /&gt; 75         proc sort data=idnew1;&lt;BR /&gt; 76         by id_job;&lt;BR /&gt; 77         run;&lt;BR /&gt; &lt;BR /&gt; NOTE: Input data set is already sorted, no sorting done.&lt;BR /&gt; NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;       real time           0.00 seconds&lt;BR /&gt;       cpu time            0.01 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 78         &lt;BR /&gt; 79         data idnew_tr;&lt;BR /&gt; 80         set idnew1;&lt;BR /&gt; 81         &lt;BR /&gt; 82         array flag(4) $ _temporary_;&lt;BR /&gt; 83         by id_job;&lt;BR /&gt; 84         retain flag;&lt;BR /&gt; 85         &lt;BR /&gt; 86         if first.id_job then do;&lt;BR /&gt; 87         count=0;&lt;BR /&gt; 88         call missing(of flag(*));&lt;BR /&gt; 89         end;&lt;BR /&gt; 90         &lt;BR /&gt; 91         count+1;&lt;BR /&gt; 92         flag(count)=idchem_char;&lt;BR /&gt; 93         &lt;BR /&gt; 94         idchem_list = catx(" ", of flag(*));&lt;BR /&gt; 95         if last.id_job then output;&lt;BR /&gt; 96         &lt;BR /&gt; 97         drop count i idchem idchem_char id job;&lt;BR /&gt; 98         run;&lt;BR /&gt; &lt;BR /&gt; WARNING: The variable i in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt; ERROR: Array subscript out of range at line 92 column 2.&lt;BR /&gt; id=OSaa01 job=2 idchem=530196 idchem_char=  id_job=OSaa01_2 FIRST.id_job=0 LAST.id_job=1 count=5 idchem_list=  _ERROR_=1 _N_=8&lt;BR /&gt; NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt; NOTE: There were 9 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; WARNING: The data set WORK.IDNEW_TR may be incomplete.  When this step was stopped there were 1 observations and 2 variables.&lt;BR /&gt; WARNING: Data set WORK.IDNEW_TR was not replaced because this step was stopped.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           0.01 seconds&lt;BR /&gt;       cpu time            0.02 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 99         &lt;BR /&gt; 100        &lt;BR /&gt; 101        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 113        &lt;BR /&gt;&lt;BR /&gt;Thanks. &lt;BR /&gt;ak.</description>
      <pubDate>Mon, 25 Nov 2019 18:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607075#M8384</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-25T18:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607079#M8385</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190754"&gt;@ak2011&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No problem&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can drop the I variable which is no more used in the drop statement as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drop idchem_list list1-list&amp;amp;count_idchem; /*line 97*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and also put &amp;nbsp;&amp;amp;count_idchem line 82 instead of 4. This macro variable is created during the first step (proc sql)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; array flag(&amp;amp;count_idchem) $ _temporary_;&amp;nbsp;/*line 82*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 18:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607079#M8385</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-11-25T18:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607081#M8386</link>
      <description>Hi,&lt;BR /&gt;Your code is right since it is working well with the smaller dataset but when I apply it to the larger one is when the error generates. I think it has to do with flag(count). Please recheck this code: Thanks.:&lt;BR /&gt;&lt;BR /&gt;      OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 72         &lt;BR /&gt; 73         /* 2. Transpose data and concatenate idchem */&lt;BR /&gt; 74         &lt;BR /&gt; 75         proc sort data=idnew1;&lt;BR /&gt; 76         by id_job;&lt;BR /&gt; 77         run;&lt;BR /&gt; &lt;BR /&gt; NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;       real time           0.36 seconds&lt;BR /&gt;       cpu time            0.37 seconds&lt;BR /&gt;       &lt;BR /&gt; NOTE: There were 124695 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; NOTE: The data set WORK.IDNEW1 has 124695 observations and 5 variables.&lt;BR /&gt; &lt;BR /&gt; 78         &lt;BR /&gt; 79         data idnew_tr;&lt;BR /&gt; 80         set idnew1;&lt;BR /&gt; 81         &lt;BR /&gt; 82         array flag(4) $ _temporary_;&lt;BR /&gt; 83         by id_job;&lt;BR /&gt; 84         retain flag;&lt;BR /&gt; 85         &lt;BR /&gt; 86         if first.id_job then do;&lt;BR /&gt; 87         count=0;&lt;BR /&gt; 88         call missing(of flag(*));&lt;BR /&gt; 89         end;&lt;BR /&gt; 90         &lt;BR /&gt; 91         count+1;&lt;BR /&gt; 92         &lt;BR /&gt; 93         do i=1 to dim(flag);&lt;BR /&gt; 94         flag(count)=idchem_char;&lt;BR /&gt; 95         end;&lt;BR /&gt; 96         &lt;BR /&gt; 97         idchem_list = catx(" ", of flag(*));&lt;BR /&gt; 98         if last.id_job then output;&lt;BR /&gt; 99         &lt;BR /&gt; 100        drop count i idchem idchem_char id job;&lt;BR /&gt; 101        run;&lt;BR /&gt; &lt;BR /&gt; ERROR: Array subscript out of range at line 94 column 3.&lt;BR /&gt; id=OSaa01 job=2 idchem=530196 idchem_char=  id_job=OSaa01_2 FIRST.id_job=0 LAST.id_job=1 count=5 i=1 idchem_list=  _ERROR_=1 _N_=8&lt;BR /&gt; NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt; NOTE: There were 9 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; WARNING: The data set WORK.IDNEW_TR may be incomplete.  When this step was stopped there were 1 observations and 2 variables.&lt;BR /&gt; WARNING: Data set WORK.IDNEW_TR was not replaced because this step was stopped.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           0.02 seconds&lt;BR /&gt;       cpu time            0.02 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 102        &lt;BR /&gt; 103        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 115        &lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;ak.&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Nov 2019 18:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607081#M8386</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-25T18:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607193#M8391</link>
      <description>I really appreciate your expert input! I am almost there:Comments(steps) #1 and 2 ok;  afew things to resolve, however.: Warning: Not all variables are in list-list18. Is there a way I can correct the warning?Also steps 3 and 4 are difficult to process by SAS. It took quite a long time for #3 and for # 4,&lt;BR /&gt;SAS has not been able to process it.&lt;BR /&gt;I think the entire data with 18 idchems should be split into 2 or 3 for this macro approah for easy processing by SAS. I would be pleased if you could help me again (if possible) to split the data into 2 or 3.&lt;BR /&gt;Thanks in advance for your help. ak.&lt;BR /&gt;&lt;BR /&gt;1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 72         &lt;BR /&gt; 73           /* MACRO APPROACH*/&lt;BR /&gt; 74         &lt;BR /&gt; 75                   libname multi'/folders/myfolders/multisitedata';&lt;BR /&gt; NOTE: Libref MULTI refers to the same physical library as _TEMP3.&lt;BR /&gt; NOTE: Libref MULTI was successfully assigned as follows: &lt;BR /&gt;       Engine:        V9 &lt;BR /&gt;       Physical Name: /folders/myfolders/multisitedata&lt;BR /&gt; 76         &lt;BR /&gt; 77          data idnew1(keep=id job idchem idchem_char id_job);&lt;BR /&gt; 78          set multi.multiworkchempostauto;&lt;BR /&gt; NOTE: Data file MULTI.MULTIWORKCHEMPOSTAUTO.DATA is in a format that is native to another host, or the file encoding does not match &lt;BR /&gt;       the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might &lt;BR /&gt;       reduce performance.&lt;BR /&gt; 79         /*length idchem_char $7;*/&lt;BR /&gt; 80         id_job=catx('_', id, job);&lt;BR /&gt; 81         &lt;BR /&gt; 82         if idchem = 990005 then idchem_char = 'cla_exp';&lt;BR /&gt; 83         else if idchem = 990021 then idchem_char = 'bio_exp';&lt;BR /&gt; 84         else if idchem = 520299 then idchem_char = 'ali_exp';&lt;BR /&gt; 85         else if idchem = 420204 then idchem_char = 'iso_exp'; /* to adapt */&lt;BR /&gt; 86         &lt;BR /&gt; 87         else if idchem = 430101 then idchem_char = 'ben_exp';&lt;BR /&gt; 88         else if idchem = 430103 then idchem_char = 'xyl_exp';&lt;BR /&gt; 89         else if idchem = 430102 then idchem_char = 'tol_exp';&lt;BR /&gt; 90         else if idchem = 430104 then idchem_char = 'sty_exp'; /* to adapt */&lt;BR /&gt; 91         &lt;BR /&gt; 92          else if idchem = 460003 then idchem_char = 'sol_exp';&lt;BR /&gt; 93         else if idchem = 220501 then idchem_char = 'for_exp';&lt;BR /&gt; 94         else if idchem = 510004 then idchem_char = 'hyp_exp';&lt;BR /&gt; 95         else if idchem = 210701 then idchem_char = 'amo_exp'; /* to adapt */&lt;BR /&gt; 96         &lt;BR /&gt; 97         &lt;BR /&gt; 98         else if idchem = 211700 then idchem_char = 'chl_exp';&lt;BR /&gt; 99         else if idchem = 410002 then idchem_char = 'cau_exp';&lt;BR /&gt; 100        else if idchem = 411501 then idchem_char = 'pho_exp';&lt;BR /&gt; 101        else if idchem = 420401 then idchem_char = 'ace_exp'; /* to adapt */&lt;BR /&gt; 102        &lt;BR /&gt; 103        else if idchem = 211701 then idchem_char = 'hcl_exp';&lt;BR /&gt; 104        else if idchem = 460004 then idchem_char = 'wpo_exp'; /* to adapt */&lt;BR /&gt; 105        run;&lt;BR /&gt; &lt;BR /&gt; NOTE: There were 124695 observations read from the data set MULTI.MULTIWORKCHEMPOSTAUTO.&lt;BR /&gt; NOTE: The data set WORK.IDNEW1 has 124695 observations and 5 variables.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           1.43 seconds&lt;BR /&gt;       cpu time            1.22 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 106        &lt;BR /&gt; 107        &lt;BR /&gt; 108        &lt;BR /&gt; 109        &lt;BR /&gt; 110        /* 1. Generate macrovariables */&lt;BR /&gt; 111        &lt;BR /&gt; 112        &lt;BR /&gt; 112      !  proc sql noprint;&lt;BR /&gt; 113        /* Retrieve the list of distinct idchems (num) in a macrovariable : &amp;amp;list_idchem */&lt;BR /&gt; 114        select distinct idchem into:list_idchem separated by " " from idnew1;&lt;BR /&gt; 115        /* Retrieve the list of distinct idchems (format) in a macrovariable : &amp;amp;list_idchem_char */&lt;BR /&gt; 116        select distinct idchem_char into:list_idchem_char separated by " " from idnew1;&lt;BR /&gt; 117        /* Retrieve the number of distinct idchems in a macrovariable : &amp;amp;count_idchem */&lt;BR /&gt; 118        select count(distinct idchem_char) into:count_idchem trimmed from idnew1;&lt;BR /&gt; 119        quit;&lt;BR /&gt; NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;       real time           0.46 seconds&lt;BR /&gt;       cpu time            0.55 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 120        &lt;BR /&gt; 121        &lt;BR /&gt; 121      !  data _null_;&lt;BR /&gt; 122        length temp $2000;&lt;BR /&gt; 123        temp=cat('"',tranwrd("&amp;amp;list_idchem_char"," ",'" "'),'"');&lt;BR /&gt; 124        call symput('list_idchem_char_q',temp);&lt;BR /&gt; 125        run;&lt;BR /&gt; &lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           0.00 seconds&lt;BR /&gt;       cpu time            0.01 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 126        &lt;BR /&gt; 127        %put &amp;amp;list_idchem;&lt;BR /&gt; 110001 110002 110004 110005 110007 110008 110009 110010 110011 110012 110013 110014 110015 110016 110017 110018 110019 110020 &lt;BR /&gt; 110021 110024 110025 110026 110028 110029 110030 110033 110501 111101 111102 111110 111301 111303 111401 111501 111600 112001 &lt;BR /&gt; 112002 112003 112005 112201 112400 112600 112601 112800 112900 113000 113001 114800 115000 118200 118201 118204 118205 130001 &lt;BR /&gt; 130101 140001 140002 140003 140004 140005 140006 140007 140008 140009 140010 140012 140013 140014 140015 140016 140017 140018 &lt;BR /&gt; 145001 150001 150002 150007 150008 150009 150010 150011 150012 150013 150014 150015 150016 150017 150018 150019 150020 150022 &lt;BR /&gt; 150023 150024 150025 150026 150027 150028 150029 150030 160001 170001 170002 170003 170004 170005 170006 170008 170009 201602 &lt;BR /&gt; 210100 210601 210602 210701 210703 210801 210901 211601 211602 211700 211701 211702 220001 220101 220102 220501 220603 221101 &lt;BR /&gt; 221102 221103 221301 225001 260001 260002 270001 310001 310002 310003 310004 311201 311301 312001 312201 312401 312501 312601 &lt;BR /&gt; 312801 312901 313001 314701 314801 315001 317901 318201 370001 370002 370004 370005 370006 370008 370009 370010 370011 370012 &lt;BR /&gt; 370013 370014 370015 370016 410001 410002 410003 410005 410704 410802 411501 411603 418000 420001 420002 420201 420202 420203 &lt;BR /&gt; 420204 420205 420303 420401 420403 420602 420701 420702 420801 420802 420803 420804 421001 421101 421302 421303 421404 421501 &lt;BR /&gt; 430101 430102 430103 430104 430201 430701 440001 440002 440003 440501 460002 460003 460004 460005 460006 460007 460008 460009 &lt;BR /&gt; 460011 460012 460013 460014 460015 460017 460019 460022 460025 460026 460027 460029 460030 460031 470001 470002 470003 470005 &lt;BR /&gt; 510001 510002 510003 510004 510005 510499 511299 511399 512299 512399 512499 512599 512699 512799 512899 512999 513099 513399 &lt;BR /&gt; 513499 514799 514899 515099 515199 515299 517499 517999 518099 518299 520197 520198 520199 520299 520599 520899 521199 521399 &lt;BR /&gt; 521499 521599 521699 521999 530193 530194 530195 530196 530197 530198 530199 530299 530399 531799 531899 890001 890002 890003 &lt;BR /&gt; 990005 990007 990008 990009 990012 990013 990014 990021 990022&lt;BR /&gt; 128        %put &amp;amp;list_idchem_char;&lt;BR /&gt; ace_exp ali_exp amo_exp ben_exp bio_exp cau_exp chl_exp cla_exp for_exp hcl_exp hyp_exp iso_exp pho_exp sol_exp sty_exp tol_exp &lt;BR /&gt; wpo_exp xyl_exp&lt;BR /&gt; 129        %put &amp;amp;list_idchem_char_q;&lt;BR /&gt; "" "ace_exp" "ali_exp" "amo_exp" "ben_exp" "bio_exp" "cau_exp" "chl_exp" "cla_exp" "for_exp" "hcl_exp" "hyp_exp" "iso_exp" &lt;BR /&gt; "pho_exp" "sol_exp" "sty_exp" "tol_exp" "wpo_exp" "xyl_exp"&lt;BR /&gt; 130        %put &amp;amp;count_idchem;&lt;BR /&gt; 18&lt;BR /&gt; 131        &lt;BR /&gt; 132        /* 2. Transpose data and concatenate idchem */&lt;BR /&gt; 133        &lt;BR /&gt; 134        proc sort data=idnew1;&lt;BR /&gt; 135        by id_job;&lt;BR /&gt; 136        run;&lt;BR /&gt; &lt;BR /&gt; NOTE: There were 124695 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; NOTE: The data set WORK.IDNEW1 has 124695 observations and 5 variables.&lt;BR /&gt; NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;       real time           0.31 seconds&lt;BR /&gt;       cpu time            0.31 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 137        &lt;BR /&gt; 138        data idnew_tr;&lt;BR /&gt; 139        set idnew1;&lt;BR /&gt; 140        &lt;BR /&gt; 141        array flag(&amp;amp;count_idchem) $ _temporary_;&lt;BR /&gt; 142        by id_job;&lt;BR /&gt; 143        retain flag;&lt;BR /&gt; 144        &lt;BR /&gt; 145        if first.id_job then do;&lt;BR /&gt; 146        count=0;&lt;BR /&gt; 147        call missing(of flag(*));&lt;BR /&gt; 148        end;&lt;BR /&gt; 149        &lt;BR /&gt; 150        count+1;&lt;BR /&gt; 151        &lt;BR /&gt; 152        do i=1 to dim(flag);&lt;BR /&gt; 153        /*flag(count)=idchem_char;*/&lt;BR /&gt; 154        end;&lt;BR /&gt; 155        &lt;BR /&gt; 156        idchem_list = catx(" ", of flag(*));&lt;BR /&gt; 157        if last.id_job then output;&lt;BR /&gt; 158        &lt;BR /&gt; 159        /*drop count i idchem idchem_char id job;*/&lt;BR /&gt; 160        drop idchem_list list1-list&amp;amp;count_idchem;&lt;BR /&gt; 161        run;&lt;BR /&gt; &lt;BR /&gt; WARNING: Not all variables in the list list1-list18 were found.&lt;BR /&gt; NOTE: There were 124695 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; NOTE: The data set WORK.IDNEW_TR has 11058 observations and 7 variables.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           0.28 seconds&lt;BR /&gt;       cpu time            0.28 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 162        &lt;BR /&gt; 163        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 175</description>
      <pubDate>Tue, 26 Nov 2019 04:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607193#M8391</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-26T04:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607231#M8393</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190754"&gt;@ak2011&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that there are two mistakes in the code:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Line 123 of your code, please insert the strip() function as follows:&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;temp=cat('"',tranwrd(strip("&amp;amp;list_idchem_char")," ",'" "'),'"');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;UL&gt;
&lt;LI&gt;Line 152-154 of your code, you have put into comment the wrong part&amp;nbsp;&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; . It should be:&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*do i=1 to dim(flag);*/
flag(count)=idchem_char;
/*end;*/
&lt;BR /&gt;idchem_list = catx(" ", of flag(*));
if last.id_job then output;
 
drop count idchem idchem_char id job;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Nov 2019 08:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/607231#M8393</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-11-26T08:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cross association between exposures: Another method without proc transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/608191#M8422</link>
      <description>Thanks very much for your time. Your code works fine with the smaller dataset but there is still a problem with the flag(count)=idchem_char;&lt;BR /&gt;Please read log below:&lt;BR /&gt;1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 72         &lt;BR /&gt; 73         &lt;BR /&gt; 74           /* MACRO APPROACH*/&lt;BR /&gt; 75         &lt;BR /&gt; 76                   libname multi'/folders/myfolders/multisitedata';&lt;BR /&gt; NOTE: Libref MULTI refers to the same physical library as _TEMP3.&lt;BR /&gt; NOTE: Libref MULTI was successfully assigned as follows: &lt;BR /&gt;       Engine:        V9 &lt;BR /&gt;       Physical Name: /folders/myfolders/multisitedata&lt;BR /&gt; 77         &lt;BR /&gt; 78          data idnew1(keep=id job idchem idchem_char id_job);&lt;BR /&gt; 79          set multi.multiworkchempostauto;&lt;BR /&gt; NOTE: Data file MULTI.MULTIWORKCHEMPOSTAUTO.DATA is in a format that is native to another host, or the file encoding does not match &lt;BR /&gt;       the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might &lt;BR /&gt;       reduce performance.&lt;BR /&gt; 80         /*length idchem_char $7;*/&lt;BR /&gt; 81         id_job=catx('_', id, job);&lt;BR /&gt; 82         &lt;BR /&gt; 83         if idchem = 990005 then idchem_char = 'cla_exp';&lt;BR /&gt; 84         else if idchem = 990021 then idchem_char = 'bio_exp';&lt;BR /&gt; 85         else if idchem = 520299 then idchem_char = 'ali_exp';&lt;BR /&gt; 86         else if idchem = 420204 then idchem_char = 'iso_exp'; /* to adapt */&lt;BR /&gt; 87         &lt;BR /&gt; 88         else if idchem = 430101 then idchem_char = 'ben_exp';&lt;BR /&gt; 89         else if idchem = 430103 then idchem_char = 'xyl_exp';&lt;BR /&gt; 90         else if idchem = 430102 then idchem_char = 'tol_exp';&lt;BR /&gt; 91         else if idchem = 430104 then idchem_char = 'sty_exp'; /* to adapt */&lt;BR /&gt; 92         &lt;BR /&gt; 93          else if idchem = 460003 then idchem_char = 'sol_exp';&lt;BR /&gt; 94         else if idchem = 220501 then idchem_char = 'for_exp';&lt;BR /&gt; 95         else if idchem = 510004 then idchem_char = 'hyp_exp';&lt;BR /&gt; 96         else if idchem = 210701 then idchem_char = 'amo_exp'; /* to adapt */&lt;BR /&gt; 97         &lt;BR /&gt; 98         &lt;BR /&gt; 99         else if idchem = 211700 then idchem_char = 'chl_exp';&lt;BR /&gt; 100        else if idchem = 410002 then idchem_char = 'cau_exp';&lt;BR /&gt; 101        else if idchem = 411501 then idchem_char = 'pho_exp';&lt;BR /&gt; 102        else if idchem = 420401 then idchem_char = 'ace_exp'; /* to adapt */&lt;BR /&gt; 103        &lt;BR /&gt; 104        else if idchem = 211701 then idchem_char = 'hcl_exp';&lt;BR /&gt; 105        else if idchem = 460004 then idchem_char = 'wpo_exp'; /* to adapt */&lt;BR /&gt; 106        run;&lt;BR /&gt; &lt;BR /&gt; NOTE: There were 124695 observations read from the data set MULTI.MULTIWORKCHEMPOSTAUTO.&lt;BR /&gt; NOTE: The data set WORK.IDNEW1 has 124695 observations and 5 variables.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           1.46 seconds&lt;BR /&gt;       cpu time            1.20 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 107        &lt;BR /&gt; 108        &lt;BR /&gt; 109        &lt;BR /&gt; 110        &lt;BR /&gt; 111        /* 1. Generate macrovariables */&lt;BR /&gt; 112        &lt;BR /&gt; 113        &lt;BR /&gt; 113      !  proc sql noprint;&lt;BR /&gt; 114        /* Retrieve the list of distinct idchems (num) in a macrovariable : &amp;amp;list_idchem */&lt;BR /&gt; 115        select distinct idchem into:list_idchem separated by " " from idnew1;&lt;BR /&gt; 116        /* Retrieve the list of distinct idchems (format) in a macrovariable : &amp;amp;list_idchem_char */&lt;BR /&gt; 117        select distinct idchem_char into:list_idchem_char separated by " " from idnew1;&lt;BR /&gt; 118        /* Retrieve the number of distinct idchems in a macrovariable : &amp;amp;count_idchem */&lt;BR /&gt; 119        select count(distinct idchem_char) into:count_idchem trimmed from idnew1;&lt;BR /&gt; 120        quit;&lt;BR /&gt; NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;       real time           0.44 seconds&lt;BR /&gt;       cpu time            0.53 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 121        &lt;BR /&gt; 122        &lt;BR /&gt; 122      !  data _null_;&lt;BR /&gt; 123        length temp $2000;&lt;BR /&gt; 124        temp=cat('"',tranwrd(strip("&amp;amp;list_idchem_char")," ",'" "'),'"');&lt;BR /&gt; 125        call symput('list_idchem_char_q',temp);&lt;BR /&gt; 126        run;&lt;BR /&gt; &lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           0.00 seconds&lt;BR /&gt;       cpu time            0.00 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 127        &lt;BR /&gt; 128        %put &amp;amp;list_idchem;&lt;BR /&gt; 110001 110002 110004 110005 110007 110008 110009 110010 110011 110012 110013 110014 110015 110016 110017 110018 110019 110020 &lt;BR /&gt; 110021 110024 110025 110026 110028 110029 110030 110033 110501 111101 111102 111110 111301 111303 111401 111501 111600 112001 &lt;BR /&gt; 112002 112003 112005 112201 112400 112600 112601 112800 112900 113000 113001 114800 115000 118200 118201 118204 118205 130001 &lt;BR /&gt; 130101 140001 140002 140003 140004 140005 140006 140007 140008 140009 140010 140012 140013 140014 140015 140016 140017 140018 &lt;BR /&gt; 145001 150001 150002 150007 150008 150009 150010 150011 150012 150013 150014 150015 150016 150017 150018 150019 150020 150022 &lt;BR /&gt; 150023 150024 150025 150026 150027 150028 150029 150030 160001 170001 170002 170003 170004 170005 170006 170008 170009 201602 &lt;BR /&gt; 210100 210601 210602 210701 210703 210801 210901 211601 211602 211700 211701 211702 220001 220101 220102 220501 220603 221101 &lt;BR /&gt; 221102 221103 221301 225001 260001 260002 270001 310001 310002 310003 310004 311201 311301 312001 312201 312401 312501 312601 &lt;BR /&gt; 312801 312901 313001 314701 314801 315001 317901 318201 370001 370002 370004 370005 370006 370008 370009 370010 370011 370012 &lt;BR /&gt; 370013 370014 370015 370016 410001 410002 410003 410005 410704 410802 411501 411603 418000 420001 420002 420201 420202 420203 &lt;BR /&gt; 420204 420205 420303 420401 420403 420602 420701 420702 420801 420802 420803 420804 421001 421101 421302 421303 421404 421501 &lt;BR /&gt; 430101 430102 430103 430104 430201 430701 440001 440002 440003 440501 460002 460003 460004 460005 460006 460007 460008 460009 &lt;BR /&gt; 460011 460012 460013 460014 460015 460017 460019 460022 460025 460026 460027 460029 460030 460031 470001 470002 470003 470005 &lt;BR /&gt; 510001 510002 510003 510004 510005 510499 511299 511399 512299 512399 512499 512599 512699 512799 512899 512999 513099 513399 &lt;BR /&gt; 513499 514799 514899 515099 515199 515299 517499 517999 518099 518299 520197 520198 520199 520299 520599 520899 521199 521399 &lt;BR /&gt; 521499 521599 521699 521999 530193 530194 530195 530196 530197 530198 530199 530299 530399 531799 531899 890001 890002 890003 &lt;BR /&gt; 990005 990007 990008 990009 990012 990013 990014 990021 990022&lt;BR /&gt; 129        %put &amp;amp;list_idchem_char;&lt;BR /&gt; ace_exp ali_exp amo_exp ben_exp bio_exp cau_exp chl_exp cla_exp for_exp hcl_exp hyp_exp iso_exp pho_exp sol_exp sty_exp tol_exp &lt;BR /&gt; wpo_exp xyl_exp&lt;BR /&gt; 130        %put &amp;amp;list_idchem_char_q;&lt;BR /&gt; "ace_exp" "ali_exp" "amo_exp" "ben_exp" "bio_exp" "cau_exp" "chl_exp" "cla_exp" "for_exp" "hcl_exp" "hyp_exp" "iso_exp" "pho_exp" &lt;BR /&gt; "sol_exp" "sty_exp" "tol_exp" "wpo_exp" "xyl_exp"&lt;BR /&gt; 131        %put &amp;amp;count_idchem;&lt;BR /&gt; 18&lt;BR /&gt; 132        &lt;BR /&gt; 133        /* 2. Transpose data and concatenate idchem */&lt;BR /&gt; 134        &lt;BR /&gt; 135        proc sort data=idnew1;&lt;BR /&gt; 136        by id_job;&lt;BR /&gt; 137        run;&lt;BR /&gt; &lt;BR /&gt; NOTE: There were 124695 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; NOTE: The data set WORK.IDNEW1 has 124695 observations and 5 variables.&lt;BR /&gt; NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;       real time           0.38 seconds&lt;BR /&gt;       cpu time            0.39 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 138        &lt;BR /&gt; 139        data idnew_tr;&lt;BR /&gt; 140        set idnew1;&lt;BR /&gt; 141        &lt;BR /&gt; 142        array flag(&amp;amp;count_idchem) $ _temporary_;&lt;BR /&gt; 143        by id_job;&lt;BR /&gt; 144        retain flag;&lt;BR /&gt; 145        &lt;BR /&gt; 146        if first.id_job then do;&lt;BR /&gt; 147        count=0;&lt;BR /&gt; 148        call missing(of flag(*));&lt;BR /&gt; 149        end;&lt;BR /&gt; 150        &lt;BR /&gt; 151        count+1;&lt;BR /&gt; 152        &lt;BR /&gt; 153        /*do i=1 to dim(flag);*/&lt;BR /&gt; 154        flag(count)=idchem_char;&lt;BR /&gt; 155        /*end;*/&lt;BR /&gt; 156        &lt;BR /&gt; 157        idchem_list = catx(" ", of flag(*));&lt;BR /&gt; 158        if last.id_job then output;&lt;BR /&gt; 159        &lt;BR /&gt; 160        drop count idchem idchem_char id job;&lt;BR /&gt; 161        &lt;BR /&gt; 162        &lt;BR /&gt; 163        run;&lt;BR /&gt; &lt;BR /&gt; ERROR: Array subscript out of range at line 154 column 1.&lt;BR /&gt; id=OSaa03 job=4 idchem=460013 id_job=OSaa03_4 idchem_char=  FIRST.id_job=0 LAST.id_job=0 count=19 idchem_list=  _ERROR_=1 _N_=54&lt;BR /&gt; NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt; NOTE: There were 55 observations read from the data set WORK.IDNEW1.&lt;BR /&gt; WARNING: The data set WORK.IDNEW_TR may be incomplete.  When this step was stopped there were 7 observations and 2 variables.&lt;BR /&gt; WARNING: Data set WORK.IDNEW_TR was not replaced because this step was stopped.&lt;BR /&gt; NOTE: DATA statement used (Total process time):&lt;BR /&gt;       real time           0.02 seconds&lt;BR /&gt;       cpu time            0.04 seconds&lt;BR /&gt;       &lt;BR /&gt; &lt;BR /&gt; 164        &lt;BR /&gt; 165        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 177  &lt;BR /&gt;ak.</description>
      <pubDate>Fri, 29 Nov 2019 09:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cross-association-between-exposures-Another-method-without-proc/m-p/608191#M8422</guid>
      <dc:creator>ak2011</dc:creator>
      <dc:date>2019-11-29T09:04:07Z</dc:date>
    </item>
  </channel>
</rss>

