BookmarkSubscribeRSS Feed
HEB1
Calcite | Level 5

hello,

I wand to construct 3 groups based on 2 variables (F_D and reporting_firm) , by CIK- that is I want to define each cik ID to 1 of the 3 groups:

Group1- every cik that has F_D =1 before reporting_firm=1

Group2- every cik that has F_D =1 and reporting_firm=0 for all cik years

Group- every cik that has F_D =0 before reporting_firm=1

 

best, 

HB

 

2 REPLIES 2
Quentin
Super User

A lot of people won't download files for security reasons.  You will make it much easier for people to help you if you post example data you HAVE as a DATA step with the CARDS statement (with 10-20 records, showing the different scenarios).  And also include the data you WANT to generate.  Also suggest including the code you have tried, and any problems with your code (wrong result, error message, etc.) .

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
ballardw
Super User

What do you want for

Group- every cik that has F_D =0 never reporting_firm=1?

 

The second reason for showing small example of the data is that you can manually show a second set with the desired result. I'm not sure what you expect a result to look like.

is your "group" variable supposed to be numeric or character? Actually say "Group1"?  What is the name of the variable to be constructed>

 

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 495 views
  • 0 likes
  • 3 in conversation