<?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: Add white row before a variable value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990112#M43965</link>
    <description>&lt;P&gt;Just have some fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data DB;
  input class :$20. subclass $20.;
cards;
DiseaseC1 Tot  
. variant1
. variant2
DiseaseC2  Tot  
. variant1
. variant12
. variant3
. variant15
;


data want;
 merge DB DB(keep=subclass rename=(subclass=_sub) firstobs=2);
 output;
 if _sub='Tot' then do;
  call missing(of _all_);output;
 end;
 drop _sub;
run;&lt;/PRE&gt;</description>
    <pubDate>Fri, 26 Jun 2026 06:46:08 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2026-06-26T06:46:08Z</dc:date>
    <item>
      <title>Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990083#M43955</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
  input class :$20. subclass $20.;
cards;

DiseaseC1  Tot  
   .        variant1
   .        variant2
DiseaseC2  Tot  
   .       variant1
   .       variant12
   .	   variant3
   .	   variant15;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to get the following?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB1;
  input class :$20. subclass $20.;
cards;

DiseaseC1  Tot  
   .        variant1
   .        variant2

DiseaseC2  Tot  
   .       variant1
   .       variant12
   .	   variant3
   .	   variant15;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In other words I need to add a white/empty row always before Tot (except for the first).&lt;/P&gt;
&lt;P&gt;Note that names are purely indicatives except for Tot that is always there.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advace&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2026 17:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990083#M43955</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-06-25T17:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990084#M43956</link>
      <description>It seems you try to create a report in a SAS dataset/table, which is not optimal.&lt;BR /&gt;If you have somewhat structured source data, there are several SAS procedures to create reports, like PRINT and REPORT. &lt;BR /&gt;You can even use a data step with PUT statements for high degree of customization.&lt;BR /&gt;Please share a sample of your source data and we could suggest a proper tool to use for your report.</description>
      <pubDate>Thu, 25 Jun 2026 14:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990084#M43956</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2026-06-25T14:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990090#M43957</link>
      <description>&lt;P&gt;Do you want to make a DATASET?&lt;/P&gt;
&lt;P&gt;Or do you want to make a REPORT?&lt;/P&gt;
&lt;P&gt;If a REPORT what type of file do you need?&amp;nbsp; PDF? HTML? Plain old text?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2026 15:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990090#M43957</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-06-25T15:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990094#M43958</link>
      <description>I need a dataset.</description>
      <pubDate>Thu, 25 Jun 2026 16:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990094#M43958</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-06-25T16:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990100#M43961</link>
      <description>&lt;P&gt;First let's fix you example input dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
  input class :$20. subclass $20.;
cards;
DiseaseC1 Tot  
. variant1
. variant2
DiseaseC2  Tot  
. variant1
. variant12
. variant3
. variant15
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Having that empty first line of data just makes your data step confusing.&amp;nbsp; And there is no need for a RUN statement.&amp;nbsp; The in-line data ends at the first line that contains a semi-colon. Or&amp;nbsp;when using CARDS4 (aka DATALINES4) a line that consists of 4 consecutive semi-colons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would just use two SET statements to make it easier to create the observation with all missing values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set db;
  if subclass='Tot' and _n_&amp;gt;1 then do;
    call missing(of _all_);
    output;
  end;
  set db;
  output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-06-25 at 1.10.46 PM.png" style="width: 386px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/116053i6B46B55C79301DC7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-06-25 at 1.10.46 PM.png" alt="Screenshot 2026-06-25 at 1.10.46 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2026 17:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990100#M43961</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-06-25T17:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990101#M43962</link>
      <description>&lt;P&gt;Can you explain why a dataset has to have a blank line?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It makes perfect sense to have an output from PROC REPORT or PROC PRINT with a blank line. I can't think of a reason why a dataset needs a blank line.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2026 17:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990101#M43962</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-06-25T17:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990112#M43965</link>
      <description>&lt;P&gt;Just have some fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data DB;
  input class :$20. subclass $20.;
cards;
DiseaseC1 Tot  
. variant1
. variant2
DiseaseC2  Tot  
. variant1
. variant12
. variant3
. variant15
;


data want;
 merge DB DB(keep=subclass rename=(subclass=_sub) firstobs=2);
 output;
 if _sub='Tot' then do;
  call missing(of _all_);output;
 end;
 drop _sub;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jun 2026 06:46:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990112#M43965</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-06-26T06:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add white row before a variable value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990126#M43967</link>
      <description>&lt;P&gt;Agree, please&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;explain why you would want such a dataset.&amp;nbsp; It's clearly a report.&amp;nbsp; Even if you're using this dataset to validate someone else's report, I'm not sure it's a good idea.&amp;nbsp; It's hard for me to come up with a good reason to create this sort of dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're truly a New User as your screen name implies, one thing that takes time to learn is that sometimes as a programmer, your boss/statistician/analyst will ask you to do something that makes sense to how they're thinking about the problem, but doesn't make sense to implement that way in SAS.&amp;nbsp; Part of growing into a senior programmer is learning how to identify those issues, and explain/adjust.&amp;nbsp; For example,&amp;nbsp; many analysts want to talk about longitudinal data as if it's in a wide format (one record per patient ID, with score_time1 score_time2 score_time3 etc.&amp;nbsp; It's fine for them to think that way, and sometimes even write requirements that way.&amp;nbsp; They don't need to know or worry that you actually store the data in a vertical format (with variables ID, Time, Score).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've never worked in pharma (and don't know if you do).&amp;nbsp; But sometimes I feel like pharma programmers often feel stuck programming whatever a spec asks for, instead of interpreting the spec, and suggesting changes to the spec.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2026 14:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-white-row-before-a-variable-value/m-p/990126#M43967</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-06-26T14:37:10Z</dc:date>
    </item>
  </channel>
</rss>

