Hello fellow SAS users,
Hoping someone can help me write a code for a relatively simple (but tedious) procedure. My data set includes dates (beginning and ending) during which an error occurred for a given observation. About 41% of Groups have errors in multiple periods. The data looks like this:
|Group Name||Type||Error Type||Period Beg||Period End|
I need each Group to correspond to only a single observation, so that line of data needs to capture all the different error periods. Something like this:
|Group Name||Type||Error Type||Period Beg||Period End||Error Type2||Period Beg2||Period End2|
Some groups have only a single error period, some have many. I was using a pretty rudimentary program using lags but it was not efficient. Any help would be greatly appreciated.
Why do you need the second example? The data as stored in the first example is a better method of storing the data.
The only time it might be useful is for a report, in which case three proc transposes, then merge back together by group name.
The end goal of what I'm asking is because I need to merge with a second dataset, and identify if the period from that dataset corresponds to an error period. If there are multiple observations for the same Group, then the merge does not take in all of those different error periods.
Please show concrete examples, presenting test data in the form of a datastep for each input dataset:
I do not see how merging with one record rather than multiple records would be any different, its exactly the same data, if date fits into one of the time periods then it merges onto that row??
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.