Hi,
I am having some difficulty trying to ceate portfolios in sas. So I have a funds data and i ant to ceate 3 separate portfolios based on
(1)funds with no lockup (lockup=0), and
(2) funds with lockup (lockup >0)
Assuming the name of your existing dataset is HAVE, you can do something similar to:
data Portfolio_1 Portfolio_2;
set have;
if lockup=0 then output Portfolio_1;
else output Portfolio_2;
run;
But with that variable lockup you could much analysis leaving the data in set, sort by the lockup variable and then process with BY statements using the lockup variable.
We need more details to provide much help.
What does your current data look like?
What do you need the result to look like?
You only mention two rules, where would the third group come from?
Hi,
I have a data set on hedge funds (a combination of the reuturns and the characteristics)
I meant to say 2 instead of 3.
So I am trying to form to different portfolios from the data.
The first portfolio will containe funds with lock up
And the second will contain funds with no lock up
"Portfolio" is not a native SAS term, so you need to express it in terms SAS can understand. Do you want to add a variable to a dataset to indicate which "portfolio" a record belongs to?
Do you want to separate a single dataset into two datasets?
Do you have a variable named LOCKUP in the data? If not, how is "lock up" determined from values of one or more variables in the data?
I have something like this. For instance;
Code Mainstrategy Aum Lockup ....
T112 Emerging market 12343 0
T119 Event driven 23432 1
T564 CTA 45667 0
So I want to separate this data set into two based on the lockup. So one will be for lockup=1 and the other for lockup=0
Assuming the name of your existing dataset is HAVE, you can do something similar to:
data Portfolio_1 Portfolio_2;
set have;
if lockup=0 then output Portfolio_1;
else output Portfolio_2;
run;
But with that variable lockup you could much analysis leaving the data in set, sort by the lockup variable and then process with BY statements using the lockup variable.
Thank you very much. This was helpful. I am pretty new at this.
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.