BookmarkSubscribeRSS Feed
Pabster
Obsidian | Level 7

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):
active.png

and like this (inactive companies):

Inactive.png


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;
3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

Can you merge THEN random select company pairs?

Pabster
Obsidian | Level 7

Yes I've already merge it to see how that would work but I can' t make it work neither

ChrisNZ
Tourmaline | Level 20

Reply unclear. If you merge first surely you can select pairs.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 601 views
  • 0 likes
  • 2 in conversation