BookmarkSubscribeRSS Feed
nishukhawale
Obsidian | Level 7

Hi,

I have data where todays closing becomes next days opening after calculations in Base SAS Code I have written and I have data from Jan2016 to Jul2016 so what is happening here is when I run one time data for 1st jan matches when I run second time data for 2nd jan matches and so on but how to cut down this repeting process short so that I can get all the matching values in one go.

 

Thnaks,

4 REPLIES 4
Shmuel
Garnet | Level 18

Please give a sample example of your data and the output you want.

SBRVamsi
Fluorite | Level 6

Please provide the dataset for further reference and to drill down on the question

 

 

Thanks 

Vamsi.

Astounding
PROC Star

We're all guessing, but this might be what you want:  compute today's opening.

 

If so, the opening for the first day can't be computed.  But here's one approach to get as much as possible from the data:

 

proc sort data=have;

by company date;

run;

 

data want;

set have;

by company;

opening = lag(closing);

if first.company then opening=.;

run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 1423 views
  • 0 likes
  • 5 in conversation