BookmarkSubscribeRSS Feed
Xiyuan
Fluorite | Level 6

we have 2 datasets: dataset 1: for each id1-id2 pair, inter_id have so many values dataset 2: for each id2-inter_id pair, y and x can have so many values final we want b for each id1-id2 pair: e.g. b_AM is calculated by regressing y on x using (K1+K2+K3) observations

 

微信截图_20220329154031.jpg

6 REPLIES 6
Xiyuan
Fluorite | Level 6
It is best not to merge like proc SQL Create because there are too many observations for datasets 1 and 2,like dataset1 can be as large as 1 million
Xiyuan
Fluorite | Level 6
by the way i have a macro when regressing, specifically, when we determine the whole data used for regression for ID1= A and ID2 =M, we can simply use %fn (variable1=Y, variable2=X) and output a dataset with coefficients of X, standard deviation, etc.
What we need to do further is to label this dataset as AM, and assign a new tag such as BM and AN when new dataset is output later. Finally, we merge to get the final result.
PeterClemmensen
Tourmaline | Level 20

So what does b_AM equal in the first obs?

Xiyuan
Fluorite | Level 6
sorry i don't give the complete K1+K2+K3 data, so there is no answer, but just regress y on x can got it, in other words, i don't really care beta, i just want to use all the y and x values which can be used for id1=A and id2=M, because i have a macro to help me regressing
Xiyuan
Fluorite | Level 6
well i got it
i find my computer allows this large dataset after merging 1 and 2,
i just need to solve how to execute the macro grouped by id1-id2
PaigeMiller
Diamond | Level 26

I'm not following the need for a macro. If you do the merge, then you can do all the regressions with a BY statement.

--
Paige Miller

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
  • 6 replies
  • 726 views
  • 1 like
  • 3 in conversation