cust_id date1 date2 date3
1001 15JAN2023 20FEB2023 30MAR2023
I want an ouput like
cust_id date1 date2 date3 date 4
1001 15JAN2023 20FEB2023 30MAR2023 15JAN2023
1001 15JAN2023 20FEB2023 30MAR2023 20FEB2023
if you guys see date1 and date2 are appended against date3
like that i want an output
i have dataset of 15000 rows
kindly guide me here
Do you want a third row with the value of date3 also?
@carl_miles wrote:
cust_id date1 date2 date3
1001 15JAN2023 20FEB2023 30MAR2023
I want an ouput likecust_id date1 date2 date3 date 4
1001 15JAN2023 20FEB2023 30MAR2023 15JAN2023
1001 15JAN2023 20FEB2023 30MAR2023 20FEB2023
if you guys see date1 and date2 are appended against date3
like that i want an output
i have dataset of 15000 rows
kindly guide me here
I feel like I don't understand where date4 comes from, or why it is needed. I don't understand how many rows will be created from this initial one row data set. What happens if there are more CUST_ID values, then what?
@carl_miles wrote:
ITS FINE
This extreme level of brevity does not help me understand the problem.
You can see the lack of specific suggestions in the responses to your posting.
I think this is primarily due to the absence of a clear description (or of any description at all) of your objective.
I suspect for every incoming observation, you want to generate two observations, one with DATE4=DATE1, and the second with DATE4=DATE2. But that notion is nothing more than an attempt at mindreading, a skill I do not trust.
If you can clearly state what you want to dio you would get a lot more help. Please help us help you.
This accomplishes what you ask for the shown values.
First is a data step to actually have values.
data have; input cust_id date1 :date9. date2 :date9. date3 :Date9.; format date: date9.; datalines; 1001 15JAN2023 20FEB2023 30MAR2023 ; data want; set have; array d (*) date1 date2; do i= 1 to dim(d); date4=d[i]; output; end; format date4 date9.; drop i; run;
Why? I don't see any practical use.
What do you intend to do with the resulting set? It may be this step just adds complications on the way to your goal.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.