Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

classifying into groups

Status
Not open for further replies.
May 12, 2009
1
US
Hi ,
I am new to base sas trying to learn on my own ,
I have a doubt , I have a data set which contain the id of firms , they start from 1991 to 1996 i want to group them into two groups which continue till 1996 for each month of every year and which disappear that mean even for a month the data about the firm is notpresent then i should group them into the second group , I have a small doubt , I am not able to check the month varaible for all the 12 months in a year , i am able to check only for one mnoth
here is my program have a look and tell how can i group then

proc sort data=akshay.temp;
by ID year ; //sorting the dataset //
run;
data new;
set akshay.temp;
if ID in(1:10) and Months eq 1( here I want to check for all the months ) and year eq 1991 (same here till 1996 ) then group = 'continue';
else group = 'discontinue';

proc print data=new;
run;


 
Can you post how your dataset looks like? I think I know what you want to accomplish.
1) You have information about something (ID) with some dated information (in another field?)
2) You want to group your data into 'Continuous' (for ID's that have information without interruption (at least 1 month) (Meaning they have data for each month from end to end [1991-1996] ) or 'Other' for all data that doesn't meet the criteria of 'Continuous'.

For me to give you an idea of how to code this I need to see your data. Can you post several records of the data you will work with?


I hope to help,
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top