Sorry, you'll have to show us a (portion of) your data. I don't understand what you want.
Also show us the desired output.
Don't show us one and not the other.
@cm3 wrote:
Correction typo mistake below
E031000. 4 2 5 E03. 303
303
312
E03100S. 1 1 4 E03. 309
300
304
Get your text, in a plain text editor like the SAS editor or Notepad. The paste into a code box using the forum's {I} to preserve the format. Otherwise the forum strips a lot of blanks, tabs and such. I am guessing that you intended something like:
E031000. 4 2 5 E03. 303 303 312 E03100S. 1 1 4 E03. 309 300 304
which would indeed be a bad structure for an actual data set. If you are wanting a REPORT that is read by people and not data fed into other procedures then say so.
The reason this would be bad as a data set is that the value of the variable userformid is no longer available for grouping for any purpose on most records. So summarizations and such are likely to be off.
It feels wrong to create such a data structure but here you go.
data want;
set have;
by Userformid;
if not first.Userformid then
do;
call missing(Userformid, RS, min_rs, max_rs, grade);
end;
run;
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 25. 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.