Is there a simple way to repeat the following values for each distinct ID and phase combination? Note: Not all subjects went through all phases.
* Values to Repeat;
data _param00_;
input paramcd $ paramn @@;
cards;
MALINPCR 1 MALINTHK 2 PCRDNS 3
THKDNS 4 PKPCRDNS 5 PKTHKDNS 6
FPDNSPCR 7 FPDNSTHK 8 DURPCR 9
;
run;
* ID Variables to Add Values to;
proc sql;
create table _param0_ as
select distinct usubjid, aphase
from phase
where not missing(avalc) or not missing(aval);
quit;
I want the resulting dataset to be like:
1 PHASE1 MALINPCR 1
1 PHASE1 MALINTHK 2
1 PHASE1 PCRDNS 3
1 PHASE1 etc.
1 PHASE2 MALINPCR 1
1 PHASE2 etc.
2 PHASE1 MALINPCR 1
2 PHASE1 etc.
Cartesian join in PROC SQL
UNTESTED CODE (because no example data has been provided)
proc sql;
create table want as select a.*,b.paramcd,b.paramn
from _param0_,param00_;
quit;
Cartesian join in PROC SQL
UNTESTED CODE (because no example data has been provided)
proc sql;
create table want as select a.*,b.paramcd,b.paramn
from _param0_,param00_;
quit;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: