BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Fatima123456
Calcite | Level 5

Hi, I wanted to find the entry and exit dates of stocks in quarterly data by a specific firm during some years. for example:

if a firm buys apple stock in quarter one and then in quarter 2. This is visible with dates in both quarters but if it sells it, it wont be in 3rd quarter. Now I want code which can show dates in which it enters and on which it exits. 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Welcome to the communities!

 

I moved this to the Programming community, since it's got nothing to do with the administration of the SAS software itself.

 

Please supply usable example data (ideally in a DATA step with DATALINES), and the expected outcome.

View solution in original post

5 REPLIES 5
Kurt_Bremser
Super User

Welcome to the communities!

 

I moved this to the Programming community, since it's got nothing to do with the administration of the SAS software itself.

 

Please supply usable example data (ideally in a DATA step with DATALINES), and the expected outcome.

Fatima123456
Calcite | Level 5

hi, I am trying to fetch the dates of stocks entry and exit in each quarter (as its quarterly data). e.g. a firm buy some stocks and it shows data of each quarter where only buy stocks are present. Now I want to get the column of change in those stocks investment market value in each quarter and dates where they are first time bought and where they exit(they are no more in the list of stocks in a quarter). Plus a column "if stock is bought then 1 otherwise zero".When they are no longer in next quarter it shows they are sold. so a column "if it is sold then 1 otherwise zero" I am attaching the screenshot of example. Riccc.png 

PaigeMiller
Diamond | Level 26

I realize you are new here, but we cannot write code based on data in a screen capture. We have to work from SAS data sets, not Excel files and not screen captures. To provide data, we need it to be provided as working SAS data step code (examples and instructions) and not in any other form. We don't need the entire data set, but enough so we can write a program and obtain the results you want.

 

I also don't understand your explanation. Please provide the desired output, and write the explanation so we can see examples of how you go from the input data to the desired output.

--
Paige Miller
Fatima123456
Calcite | Level 5
Yes I am novice. Thank you so much for your guidance, I will follow these instructions.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1129 views
  • 0 likes
  • 3 in conversation