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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 984 views
  • 5 likes
  • 2 in conversation