Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you transpose the dataset by the observation number, then <code>proc report</code> can handle it with no problem. hth.</p> <pre><code>/* test data -- each obs is identified by obsId */ data class; set sashelp.class; obsId = _n_; run; /* transpose the data */ proc transpose data=class out=report(rename=(_name_=var col1=value)); var _all_; by obsId; run; /* change the varaible name into "Line 1 text ..." */ data report; drop line cLine dashes; length var cLine $30; dashes = repeat("-", 20-1); /* usual DoW */ do line = 1 by 1 until (last.obsId); set report; by obsId; cLine = put(line, best.-l); var = "Line "||trim(cline)||" text "||dashes; output; end; run; /* print out one obs per page */ options nocenter; proc report data=report nowd; column obsId var value; define obsId / " " group noprint; define var / " " display left; define value / " " display left; break after obsId / page; compute before obsId; id = put(obsId, best.-l); len = length(id); line @2 "Header Text Observation Id " iD $varying. len; line " "; endcomp; run; /* on lst, in part. Header Text Observation Id 1 Line 1 text ------------------ Alfred Line 2 text ------------------ M Line 3 text ------------------ 14 Line 4 text ------------------ 69 Line 5 text ------------------ 112.5 Line 6 text ------------------ 1 (new page) Header Text Observation Id 2 Line 1 text ------------------ Alice Line 2 text ------------------ F Line 3 text ------------------ 13 Line 4 text ------------------ 56.5 Line 5 text ------------------ 84 Line 6 text ------------------ 2 (new page) ... */ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload