<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Writing  _null_/file print routines in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574275#M162239</link>
    <description>&lt;P&gt;Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;There is no variable table in dataset AAA, but you try to use it in the output. Therefore you only get missing values.&lt;/P&gt;
&lt;P&gt;See if you misspelled the variable, here or further up in the code where you created it.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jul 2019 16:48:24 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-07-17T16:48:24Z</dc:date>
    <item>
      <title>Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574232#M162218</link>
      <description>&lt;P&gt;Hello programmers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that i want to put out in the form like in the picture attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to use the data _null_ /file print routines but i think i'm missing something that may help me get the form that i am looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to output the dataset into two pages. With the first page showing output for run=1 and the second page showing output for run=2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was told that my variable table did not initialize. Please what could be the problem? Any help would be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data AAA;
input  grporder	grpname $	Tc	Tn $	Mean_baseline	Mean_12_months		std_baseline	std_12_months prob_change	run;
datalines;
1	Motor 	2	UHDRS	32.8571	29.7143	6.2029	7.5435	0.29688	1
1	Motor 	3	CHOREA	11.8571	10.1429	3.7607	1.8645	0.15625	1
1	Motor 	4	GAIT	1.2857	1.2857	0.488	0.7559	1	1
1	Motor 	5	TANDEM	1.8571	1.5714	1.069	1.3973	0.75	1
1	Motor 	6	PULL	0.1429	0.7143	0.378	0.7559	0.125	1
1	Motor 	7	BALANCE	3.2857	3.5714	1.3801	2.6367	1	1
2	Physical	1	TFC	6.5714	7	0.9759	2.1602	0.625	1
2	Physical 	13	FA	20.2857	19.1429	2.2147	3.2367	0.3125	1
2	Physical 	14	IS	77.1429	71.4286	8.5912	7.4801	0.28125	1
3	Cognigtive 	8	COWA	27.1667	31.5	8.2321	13.896	0.1875	1
3	Cognigtive	9	SYMBAL 	25.1429	20.1429	5.113	7.1514	0.09375	1
3	Cognigtive	10	STROOP 1	45.8571	38.2857	13.5576	17.1437	0.04688	1
3	Cognigtive 	11	STROOP 2	61.7143	52.2857	19.414	22.5367	0.03125	1
3	Cognigtive	12	STROOP 3	29.4286	28.1429	9.6065	10.4152	0.40625	1
3	Cognigtive	15	MMSE	27.5	26.8333	2.51	2.6394	0.625	1
1	Motor 	2	UHDRS	33.8333	27.5	6.1779	5.2058	0.03125	2
1	Motor 	3	CHOREA	12.1667	10.3333	4.0208	1.9664	0.1875	2
1	Motor 	4	GAIT	1.3333	1.1667	0.5164	0.7528	1	2
1	Motor 	5	TANDEM	1.8333	1.1667	1.169	0.9832	0.25	2
1	Motor 	6	PULL	0	0.5	0	0.5477	0.25	2
1	Motor 	7	BALANCE 	3.1667	2.8333	1.472	1.9408	0.5	2
2	Physical	1	TFC	6.6667	7.5	1.0328	1.8708	0.25	2
2	Physical 	13	FA	20.6667	20.1667	2.1602	1.9408	0.625	2
2	Physical 	14	IS	78.3333	73.3333	8.756	6.0553	0.5	2
3	Cognigtive 	8	COWA	29.2	35	7.328	12.227	0.125	2
3	Cognigtive	9	SYMBAL 	25.6667	21.5	5.3914	6.775	0.1875	2
3	Cognigtive	10	STROOP 1	45.5	39.1667	14.8155	18.6056	0.09375	2
3	Cognigtive 	11	STROOP 2	61.3333	52.8333	21.2383	24.6367	0.0625	2
3	Cognigtive	12	STROOP 3	29.1667	28	10.496	11.4018	0.625	2
3	Cognigtive	15	MMSE	27.6	27.2	2.7928	2.7749	0.875	2
; run;
proc print; run;
proc sort data=AAA; by run grporder grpname tc tn;run;
data BBB ; set AAA; by run grporder grpname tc tn; 
options nodate nonumber; 
file print notitles header = newpage;
if first.run then put _page_;
if first.grpname then put tn $33.  @;   
put @ 1 'Including pt 5' table 1.; 
put @30 'Mean_baseline' @40 'std_baseline' @50 'Mean_12_months' @60 'Std_12_months'    @70 'prob_change' ;  
return; 
newpage:
if last.run then put _page_;
if last.grpname then put tn $33. @;
put @ 1 'Excluding pt 5' tbale 2.;
put @30 'Mean_baseline' @40 'std_baseline' @50 'Mean_12_months' @60 'Std_12_months'    @70 'prob_change' ;  
return; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.JPG" style="width: 484px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31088i552FC19273615B01/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.JPG" alt="1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 15:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574232#M162218</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-07-17T15:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574233#M162219</link>
      <description>Why don't you just create a table and use PROC PRINT or PROC REPORT? Or do you need structured text files?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jul 2019 15:43:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574233#M162219</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-17T15:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574246#M162224</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please can't i do it using this method?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 15:56:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574246#M162224</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-07-17T15:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574251#M162226</link>
      <description>You can do whatever you want, but not sure what you're planning to prepare here. Most people want data in Excel or Word files these days, not text files. &lt;BR /&gt;&lt;BR /&gt;put @ 1 'Including pt 5' table 1.; &lt;BR /&gt;&lt;BR /&gt;You should post your log, as we've indicated many times it tells usually where the error is. I suspect its in that line and you don't have a variable table so not sure what value you're trying to refer to there. &lt;BR /&gt;&lt;BR /&gt;If you use search on your program you'll see the first reference to table is in your PUT statement. I'll leave it to you to debug it from there.</description>
      <pubDate>Wed, 17 Jul 2019 16:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574251#M162226</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-17T16:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574252#M162227</link>
      <description>&lt;PRE&gt;242  data BBB ; set AAA; by run grporder grpname tc tn;
243  options nodate nonumber;
244  file print notitles header = newpage;
245  if first.run then put _page_;
246  if first.grpname then put tn $33.  @;
247  put @ 1 'Including pt 5' table 1.;
248  put @30 'Mean_baseline' @40 'std_baseline' @50 'Mean_12_months' @60 'Std_12_months'    @70
248! 'prob_change' ;
249  return;
250  newpage:
251  if first.run then put _page_;
252  if first.grpname then put tn $33. @;
253  put @ 1 'Excluding pt 5' table 2.;
254  put @30 'Mean_baseline' @40 'std_baseline' @50 'Mean_12_months' @60 'Std_12_months'    @70
254! 'prob_change' ;
255  return;
256  run;

NOTE: Variable table is uninitialized.
NOTE: 76 lines were written to file PRINT.
NOTE: There were 30 observations read from the data set WORK.AAA.
NOTE: The data set WORK.BBB has 30 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.06 seconds

&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jul 2019 16:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574252#M162227</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-07-17T16:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574258#M162231</link>
      <description>Did you mean to include some text with that post. Not sure what that's supposed to show. SAS is telling you that you don't have a variable called TABLE, which from the code you've show appears to be correct. There is no variable named TABLE.</description>
      <pubDate>Wed, 17 Jul 2019 16:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574258#M162231</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-17T16:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574275#M162239</link>
      <description>&lt;P&gt;Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;There is no variable table in dataset AAA, but you try to use it in the output. Therefore you only get missing values.&lt;/P&gt;
&lt;P&gt;See if you misspelled the variable, here or further up in the code where you created it.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 16:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574275#M162239</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-17T16:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Writing  _null_/file print routines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574300#M162249</link>
      <description>&lt;P&gt;What values go into those cells?&lt;/P&gt;
&lt;P&gt;It really looks like you are intending some sort of summary since your example data has at least 12 values of "motor" but your table example&amp;nbsp;only shows one row with "motor" for the group name. Depending on the actual desired values of your cells this might be a better case for proc report.&lt;/P&gt;
&lt;P&gt;Either that or your example doesn't match the data orders at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FILE PRINT ODS in a data step will make prettier tables in the ods destinations.&lt;/P&gt;
&lt;P&gt;PUT _ODS_ to control output, which uses ODS column numbers instead of character spaces to play with values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have done manual tables, much nastier than your examples, to include using proprietary markup language to make pretty tables and would avoid most of that like a plague if at all possible. We had to play around with changing table definitions just because a value showed up that took more space with the same number of letters because W is wider than most other letters.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 17:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-null-file-print-routines/m-p/574300#M162249</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-17T17:27:15Z</dc:date>
    </item>
  </channel>
</rss>

