BookmarkSubscribeRSS Feed
Mumbai_1983
Calcite | Level 5

Hi

I have a dataset in the format below. I am interested in having a Days to Departure range of 0-365 for all products/subproducts for a journey date.

journey_Dateproduct_codeproduct_subcodeDays_to_DepBooked
01/04/20141001201
01/04/201410013009
01/04/2014101111
01/04/201410113003
4 REPLIES 4
ballardw
Super User

What should the output look like for your example data?

And since dates are involved, what about leap years?

Mumbai_1983
Calcite | Level 5

Hi the output should have days to departure (0-365) essentially 365 rows for each product code and sub code ... For product code 100 and sub code 1, the days to departure will be 0 to 365 (365 rows) and value of sold will be recorded against rows 20 and 300...

I always look for last 365 rows, so no problems with leap years for now.

My approach has been to create a  lookup dataset for days to departure (with one column containing 365 rows each representing one day to departure). I then multiply that table with my original dataset to achieve what I said above. However, I was wondering if there is an alternative way (quicker) to do the same?

The newly created dataset will have a missing value for days there was no sale and that's fine

Jagadishkatam
Amethyst | Level 16

you mean to format the Days_to_Dep with 0-365

Thanks,
Jag
Mumbai_1983
Calcite | Level 5

Hi,

I would like the final dataset to have 365 rows for each product code and sub code. So for product 100 and subcode 1, the resulting dataset will have only values for days 20 and 300, all others rows will have a missing value.

I am only interested in 0-365 days, so not worried about leap years.

My approach has been to create a dataset with 365 rows and a CROSS JOIN to the above table to get the desired output, but I was wondering if there are alternative solutions?

Thanks

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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