BookmarkSubscribeRSS Feed
jan_t_lagen
Calcite | Level 5

In my project I need to iteratively sample some portfolio data and run this through a model. To reduce computation time in the model I have created a key that makes use of the symmetry and clumps all similar entities in the portfolio together. When trying without iterating this is easily done by some group by statements. This is roughly what i'm doing:

 

proc surveyselect data=tot

method=srs n=10000 out=port_in noprint;

run;

 

Proc Sql;

Create table port as 

select distinct KEY_ID, ID_1, ID_2, sum(w) as w_s

from port_in

group by KEY_ID

;quit;

 

where KEY_ID is a unique number for all combinations of ID_1 and ID_2.

 

I know that I can call on these inside my proc iml but what i want to know if this is the most efficient way of achieving what i want or if using only iml functions is better. So what i want to achieve is this:

 

1 Sample a portfolio from a larger one

2 Reduce its size by summing and only getting distinct values

3 Insert 2 into a model

4 Repeat

1 REPLY 1
Rick_SAS
SAS Super FREQ

Since PROC SURVEYSEELCT supports the STRATA statement and PROC SQL supports the GROUP BY statement, it seems that you could do this outside of IML. The result would be a data set that contains samples for each portfolio.

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!
Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 742 views
  • 0 likes
  • 2 in conversation