Hello,
I would appreciate if someone could help me with the SAS code for storing final results at a file and retrieving the information directly from the stored dataset and using it without going through all the several steps.
Please find below this dataset and the SAS procedures used to arrive at the final dataset t2b.
Eg. if I complete work today and write final results to dataset t2b. Is there a code to directly obtain the stored information and use to for for say logistic regression without going though all the many steps?
/*DATASET 1*/ 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.; id_job=catx('_', id, job); put _all_; run; proc sort data=temp; by id job id_job; run; proc transpose data=temp out=idnew2(drop=_name_); by id job id_job; id idchem; var dum; run; proc print data=idnew2; Title "Table 1: Merged exposure files for cla, bio, amo and chl pollutants"; run; /*Replacing missing values(.)with zeros(0) ie. unexposed*/ data t; set idnew2; proc stdize out=t2 reponly missing=0; drop _type_; run; proc sort; by id job; Title " Table 2: Merged exposure files for cla, bio, amo and chl pollutants: missing values replaced with zeros"; proc print data=t2; run; /*FINDING FREQUENCIES OF ASSOCIATIONS*/ proc freq data=t2; tables cla_exp*bio_exp cla_exp*amo_exp cla_exp*chl_exp bio_exp*amo_exp bio_exp*chl_exp bio_exp*chl_exp; Title "Frequencies of associations between cla, bio, amo and chl pollutants"; run; /* COUNTING EXPOSED IDS PER AGENT! GOOD! KEEP IT!*/ /* CHECKING NUMBER OF UNIQUE IDS*/ Proc summary data= t2 nway ; class id; var cla_exp bio_exp amo_exp chl_exp; output out=t2b(drop=_type_ _freq_) max=; run; Title "Table of unique IDs for cla bio amo and chl"; proc print; proc freq data=t2b; tables cla_exp bio_exp amo_exp chl_exp; Title "Unique ids frequecies for cla, bio, amo and chl"; run; proc freq data=t2b; tables cla_exp*bio_exp cla_exp*amo_exp cla_exp*chl_exp bio_exp*amo_exp bio_exp*chl_exp bio_exp*chl_exp; Title "Frequencies of UNIQUE IDS exposure associations between cla, bio, amo and chl agents"; run; Next time,I wish to start work directly form dataset t2b and not to run entire work again ie. starting from dataset idnew1. Please find attached SAS log. Thank you in advance. ak.
... View more