Hi all.
I posted this question before but apparently it looks more like a case of random case-control sampling.
So my data looks like this(Active companies):
and like this (inactive companies):
I need SAS to randomly select an ACTIVE(so the COSTAT of the company =0) company from the Active data set and pair it to an Inactive company(COSTAT=1) from my second data set.
The pairing only has two constraint, the active company must be in the same industry as the inactive one (same SIC) and the same Fyear for proper analysis.
My final set should look somehow like this:
DATADATE FYEAR DLRSN CONM DLDTE COSTAT SICH
03/12/1992 1989 . A 0 112
03/12/1993 1989 02 B 1990 1 112
03/12/1994 1990 . D 0 333
03/12/1992 1990 03 F 1992 1 333
03/12/1993 1994 . J 0 445
03/12/1994 1994 03 L 1996 1 445
03/12/1998 1998 . I 0 001
03/12/1998 1998 02 Z 2000 1 001
Hope it`s clear and you guys can me help me out.
*UPDATE*
I used this code to create a random sample data set for the active companies and then merge it with the inactive one. Their is just no pairing what so ever. I just need ONE active for ONE inactive.:
proc surveyselect data=AltmanV2.Donnee_Avant_F_Sante
out=StratifiedSRS
sampsize=1643
method=srs
outall;
strata COSTAT;
run;
data Strat;
set StratifiedSRS;
if Selected=1 then output;
else delete;
run;
data test;
set Strat AltmanV2.Donnee_Avant_F;
SIC=INT(input(SIC,4.)/100);
run;
proc sort data= test;
by Fyear SIC;
run;
Can you merge THEN random select company pairs?
Yes I've already merge it to see how that would work but I can' t make it work neither
Reply unclear. If you merge first surely you can select pairs.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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: