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

i have unique customers list, and would like to get each customer 31 times by adding one full month dates.

result supposed to be as attached.

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Hi,

Were you looking for something like the following:

data have;

  input custnbr $char6.;

  datalines;

123456

123457

123458

123459

123460

123461

123462

123463

123464

;

data want;

  set have;

  do date='01MAY13'd to '31MAY13'd;

    output;

  end;

run;

Regards,

Amir.

View solution in original post

4 REPLIES 4
Amir
PROC Star

Hi,

Were you looking for something like the following:

data have;

  input custnbr $char6.;

  datalines;

123456

123457

123458

123459

123460

123461

123462

123463

123464

;

data want;

  set have;

  do date='01MAY13'd to '31MAY13'd;

    output;

  end;

run;

Regards,

Amir.

Alankar
Fluorite | Level 6

Thank you so much! can i ask one more question?

below XXXX is any interger.

if any decinmal value is greater than or equal XXXX.995 then it should become XXXX+1 else it should give lower integer XXXX

what could be the finction?

i am using some messy statement like below :

A = 564.995456

B = int(A) = 564

if A - B >= 0.995 then B = B + 1;

Amir
PROC Star

Hi,

I'm glad my last post answered your question, feel free to mark it answered if you can and to raise a new discussion for a new question in future. On this occasion, I'm not aware of a function that would directly do what you are asking, but how about the following:

data _null_;

  a=564.995456; /* should become 565 */

  b=int(a+0.005);

  put a= b=;

 

  a=564.994456; /* should stay as 564 */

  b=int(a+0.005);

  put a= b=;

run;

Regards,

Amir.

Amir
PROC Star

Hi,

If there is a chance that the original number could be missing then it might be worth using the sum function which would return 0 if the original was missing. E.g.:

b=int(sum(a,0.005));

Regards,

Amir.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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