<?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: REPORT procedure: uninitialized variable in a COMPUTE block in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/REPORT-procedure-uninitialized-variable-in-a-COMPUTE-block/m-p/713433#M220103</link>
    <description>&lt;P&gt;After I posted, the ORDER option to the DEFINE statement caught my eye.&amp;nbsp; Adding ORDER to the DEFINE statement for LEVEL resolves the issue.&amp;nbsp; I will not have a think about the process &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2021 17:56:23 GMT</pubDate>
    <dc:creator>Kevin_Viel</dc:creator>
    <dc:date>2021-01-22T17:56:23Z</dc:date>
    <item>
      <title>REPORT procedure: uninitialized variable in a COMPUTE block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/REPORT-procedure-uninitialized-variable-in-a-COMPUTE-block/m-p/713431#M220101</link>
      <description>&lt;P&gt;I am struggling to understand an issue about an uninitialized value in a variable that I use in a COMPUTE block that does not have a missing value.&amp;nbsp; I have used this approach before.&amp;nbsp; I got the hint on this board from Cynthia Zender.&amp;nbsp; If I change to a character version, no issue are reported and the report is formatted as intended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;8748  data __folder_transferred ;
8749    set __folder_transferred ;
8750    levelc = put( level , 8. -L ) ;
8751  run ;

NOTE: There were 700 observations read from the data set WORK.__FOLDER_TRANSFERRED.
NOTE: The data set WORK.__FOLDER_TRANSFERRED has 700 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


8752
8753  ods listing close ;
8754
8755  ods rtf file = "XXXXX.rtf" newfile = none startpage = no ;
NOTE: Writing RTF Body file: XXXXX.rtf
8756
8757  proc report data = __folder_transferred style( header ) = { just = l } style( report ) = { width = 100% rules = none } style( column ) = { borderstyle = none rules = none bordercolor = red } ;
8758    column ( "Section II. Files Transferred" "`{style [ fontweight = medium backgroundcolor  = lightgrey ]Provide file information below (e.g., package names, individual file names, sizes, etc.).}"
8759             group level file size units
8760           ) ;
8761    define group / noprint order ;
8762    define level / noprint  ;
8763    define file / " " style ( column ) = { cellwidth = 70% just = l  } ;
8764    define size / " " style ( column ) = { cellwidth = 20% just = r } format = comma9. ;
8765    define units / " " style ( column ) = { cellwidth = 8% just = l } ;
8766    compute before group / style = { fontweight = bold just = l backgroundcolor = lightgrey } ;
8767    length text $ 100 ;
8768    if group = 0 then text = "Files Transferred:" ;
8769    else text = "Individual File Names:" ;
8770    line text $100. ;
8771    endcomp ;
8772
8773    compute file ;
8774      if level = 1 then call define ( _col_ , "style" , "style = { leftmargin = 4% }" ) ;
8775       else if level = 2 then call define ( _col_ , "style" , "style = { leftmargin = 8% }" ) ;
8776    endcomp ;
8777
8778  run ;

NOTE: Variable level is uninitialized.
NOTE: PROCEDURE REPORT used (Total process time):
      real time           0.74 seconds
      cpu time            0.46 seconds

NOTE: There were 700 observations read from the data set WORK.__FOLDER_TRANSFERRED.

8779
8780  proc report data = __folder_transferred style( header ) = { just = l } style( report ) = { width = 100% rules = none } style( column ) = { borderstyle = none rules = none bordercolor = red } ;
8781    column ( "Section II. Files Transferred" "`{style [ fontweight = medium backgroundcolor  = lightgrey ]Provide file information below (e.g., package names, individual file names, sizes, etc.).}"
8782             group levelc file size units
8783           ) ;
8784    define group / noprint order ;
8785    define levelc / noprint  ;
8786    define file / " " style ( column ) = { cellwidth = 70% just = l  } ;
8787    define size / " " style ( column ) = { cellwidth = 20% just = r } format = comma9. ;
8788    define units / " " style ( column ) = { cellwidth = 8% just = l } ;
8789    compute before group / style = { fontweight = bold just = l backgroundcolor = lightgrey } ;
8790    length text $ 100 ;
8791    if group = 0 then text = "Files Transferred:" ;
8792    else text = "Individual File Names:" ;
8793    line text $100. ;
8794    endcomp ;
8795
8796    compute file ;
8797      if levelc = "1" then call define ( _col_ , "style" , "style = { leftmargin = 4% }" ) ;
8798       else if levelc = "2" then call define ( _col_ , "style" , "style = { leftmargin = 8% }" ) ;
8799    endcomp ;
8800
8801  run ;

NOTE: There were 700 observations read from the data set WORK.__FOLDER_TRANSFERRED.
NOTE: PROCEDURE REPORT used (Total process time):
      real time           0.08 seconds
      cpu time            0.07 seconds


8802
8803
8804  ods rtf close ;
8805  ods listing ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As you can see, the data step does not report a missing value.&amp;nbsp; The second REPORT procedure, a copy of the first with LEVEL replaced by LEVELC, runs without issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone see what I am overlooking?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 17:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/REPORT-procedure-uninitialized-variable-in-a-COMPUTE-block/m-p/713431#M220101</guid>
      <dc:creator>Kevin_Viel</dc:creator>
      <dc:date>2021-01-22T17:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: REPORT procedure: uninitialized variable in a COMPUTE block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/REPORT-procedure-uninitialized-variable-in-a-COMPUTE-block/m-p/713433#M220103</link>
      <description>&lt;P&gt;After I posted, the ORDER option to the DEFINE statement caught my eye.&amp;nbsp; Adding ORDER to the DEFINE statement for LEVEL resolves the issue.&amp;nbsp; I will not have a think about the process &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 17:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/REPORT-procedure-uninitialized-variable-in-a-COMPUTE-block/m-p/713433#M220103</guid>
      <dc:creator>Kevin_Viel</dc:creator>
      <dc:date>2021-01-22T17:56:23Z</dc:date>
    </item>
  </channel>
</rss>

