BookmarkSubscribeRSS Feed
EJAA
Obsidian | Level 7

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. 

6 REPLIES 6
FredrikE
Rhodochrosite | Level 12

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

EJAA
Obsidian | Level 7

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

FredrikE
Rhodochrosite | Level 12

Have you tried my code example?

Can you provide some of your tries, and maybe an example of what you want to accomplish 🙂

//Fredrik

error_prone
Barite | Level 11
You need the connections between firms stored in a file, without that information solving the problem ist hardly possible. Or does any logic exist to identify the connection?
EJAA
Obsidian | Level 7

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. 

EJAA
Obsidian | Level 7

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 746 views
  • 0 likes
  • 3 in conversation