BookmarkSubscribeRSS Feed
RJY
Fluorite | Level 6 RJY
Fluorite | Level 6

Hello,

 

I am finding difficult to create cumulative records. Your valuable suggestions will be a great help.

 

Input data:

IDsalesweek
1012240
1013440
1016040
1011041
1011042
1022240
1023441
1026041
1031040
1031040
1032241
1033442

 

Required Output:

 

Idsalesweekweekg
101224040-40
101344040-40
101604040-40
102224040-40
103104040-40
103104040-40
101224040-41
101344040-41
101604040-41
102224040-41
103104040-41
103104040-41
101104140-41
102344140-41
102604140-41
103224140-41
101224040-42
101344040-42
101604040-42
102224040-42
103104040-42
103104040-42
101104140-42
102344140-42
102604140-42
103224140-42
101104240-42
103344240-42

 

I tried with if condition records are getting over written. And, another options is with filter i have to split the data and append.

 

I am looking for simple solution. Thanks in advance.

 

Regards,

RS

 

2 REPLIES 2
andreas_lds
Jade | Level 19

Please post data in usable form. Also add a description of the logic you want applied.

ballardw
Super User

How many levels of "week" are you looking to use this way?

 

I don't see that as a "cumulative" anything as you are repeating individual values multiple times.

Something like this may be possible with a multilabel format but that could be somewhat fragile as we likely need to know much more about what you are actually doing with the "week" values.

 

Perhaps it may be better to describe what you would do with the resulting data set. Sometimes new SAS user try to translate a process from an existing one exactly step by step and are unaware of SAS tools that perform some fairly interesting thing using a different approach.

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 326 views
  • 0 likes
  • 3 in conversation