BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bukky09
Fluorite | Level 6

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)

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

7 REPLIES 7
ballardw
Super User

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?

bukky09
Fluorite | Level 6

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

ballardw
Super User

"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?

bukky09
Fluorite | Level 6

 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

 

bukky09
Fluorite | Level 6
So I have provision for lockup already
ballardw
Super User

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.

bukky09
Fluorite | Level 6

Thank you very much. This was helpful. I am pretty new at this.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 926 views
  • 0 likes
  • 2 in conversation