Jill,
The code, below, imports your test data and then shows how to use the transpose macro (as I originally posted) to make your long file wide, as well as how to use the untranspose macro to make your wide file long (and, at the same time, add the seq_ID variable you mentioned in your initial post).
You can find the actual macros, papers, powerpoints and tip sheets at:
https://github.com/art297/transpose
and
https://github.com/art297/untranspose
Here is the code:
filename reffile '/folders/myfolders/Partial Dataset C.csv';
proc import datafile=reffile
DBMS=CSV
OUT=work.have;
GETNAMES=YES;
RUN;
filename tr url 'https://raw.githubusercontent.com/art297/transpose/master/transpose.sas';
%include tr ;
%transpose(data=have, out=want_wide, by=MRN Date, Guessingrows=1000,
autovars=all, sort=yes)
filename ut url 'https://raw.githubusercontent.com/art297/untranspose/master/untranspose.sas';
%include ut ;
%untranspose(data=want_wide, out=want_long, by=MRN Date,
id=seq_ID,
var=Enc_Code Enc_Type Enc_Complete Dx_Code Dx_Name Prov_Name Dept_ID Dept_Name
Hosp_Adm_Code Hosp_Adm_Name Pt_Class_Code Pt_Class_Name Surg_Loc_Name
Discharge_Date)
Art, CEO, AnalystFinder.com
... View more