Hi All
I have daily stock price data for 1000 firms. I need to form portfolios of firms that are connected to each other. For instance in my sample data attached, firm with Permno number 10001 is connected to firms with permno number 1002, 1009,10012,10019. I want to form a portfolio consisting of these four firms (1002, 1009,10012,10019) that are connected to firm 10001. How do i resolve this problem. Thanks in advance for the assitance. rgds ejaa.
How do you know the connection, do you have them in another file?
Otherwise you could create a group data set which contains group and firms and then join that data set with your details.
After that it is easy to summarize or whatever you want 🙂
data groups;
length group firm $32;
input group firm;
datalines;
group1 10001
group1 10002
group1 10003
group2 11001
group2 11002
....
....
;
run;
proc sql;
create jointV as
select * from groups as a
left join details as b
on a.firm = b.permno
;
quit;
//Fredrik
Hi Fredrike
With reference to the connections, yes i do have them on a different sheet. Thus each firm and the firms connected to it. Thanks
Have you tried my code example?
Can you provide some of your tries, and maybe an example of what you want to accomplish 🙂
//Fredrik
Hi error_prone
I have the connections among firms established using a set of rules hence me been able to indicate that firm 10001 in the attached sample is connected to four firms in the data. So for each firm, I have on all other firms connected to it and want to create a portfolio for the connected firms using daily prices which is proving difficult. Thanks.
I have the connections stored in another file. I want to read from the two data sets to create the groups/connected firms. any directions for me. thanks in advance.rgds
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!
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.