<?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: Variable name from horizontal to vertical in sas dataset (not in proc outputs) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765465#M242470</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Very nice.&amp;nbsp; &amp;nbsp;The ability to support vertical display of var names might be a worthy request for SAS developers.&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Sep 2021 18:41:48 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2021-09-01T18:41:48Z</dc:date>
    <item>
      <title>Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765389#M242439</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anybody know if there is any technique to change variable name from horizontal to vertical? It should be in sas dataset, not in proc step outputs (as I know in proc print it is possible).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ex:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have&amp;nbsp; &lt;STRONG&gt;SUBJID AGE GENDER&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Want&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;S&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;G&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;U&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;G&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; E&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;E&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;J&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;D&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; E&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;D&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;R&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks, in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 15:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765389#M242439</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2021-09-01T15:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765405#M242451</link>
      <description>&lt;P&gt;like this?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-09-02_00h31_25.png" style="width: 220px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63209iBCF4F534294ACAF8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2021-09-02_00h31_25.png" alt="2021-09-02_00h31_25.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know there is no way to do this, but please let me know why you want to do it that way. I'm interested.&lt;/P&gt;
&lt;P&gt;(The image above is just a variable label with a space in it.)&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 15:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765405#M242451</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-09-01T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765414#M242456</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your feedback. There is a big dataset with more than 200 variables, with long variable names but with only single digits as a value. Having vertical variable name could make it shorter and easier to read.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 15:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765414#M242456</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2021-09-01T15:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765417#M242458</link>
      <description>&lt;P&gt;No such thing if you are referring to SAS data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to create an output, then PROC PRINT will do this.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 15:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765417#M242458</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-01T15:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765462#M242467</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321371"&gt;@A_Kh&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good idea from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;to use labels instead of variable names. So you could create a copy of the dataset in question with "vertical" labels (or just add those labels to the existing dataset if it doesn't have variable labels yet). Then use &lt;SPAN&gt;the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://support.sas.com/downloads/package.htm?pid=2173" target="_blank" rel="nofollow noopener noreferrer"&gt;SAS Universal Viewer&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;rather than the Viewtable window to view the dataset (and switch to "Display Labels" in the View menu or the context menu of a column header, see screenshot below).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create sample data for demonstration */

data have;
input SUBJID $ AGE GENDER $;
cards;
001 42 F
;

/* Create list of variable names */

proc transpose data=have(obs=0) out=varlist;
var _all_;
run;

/* Write PROC DATASETS code to a temporary file */

filename lblcode temp;

data _null_;
file lblcode;
set varlist end=last;
if _n_=1 then do;
  put 'proc datasets lib=work nolist; modify have;';
  put 'label';
end;
put _name_ '= "' @;
w=length(_name_);
do i=1 to w;
  c=char(_name_,i);
  put c $hex2. @;
  if i&amp;lt;w then put '0D0A' @;
end;
put '"x';
if last then put '; quit;';
run;

/* Add the variable names as "vertical" labels to dataset WORK.HAVE */

%inc lblcode;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vert_labels.png" style="width: 518px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63222iEC62C77E5C5FBDC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="vert_labels.png" alt="vert_labels.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Edit: Added comments to the SAS code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 18:37:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765462#M242467</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-09-01T18:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765465#M242470</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Very nice.&amp;nbsp; &amp;nbsp;The ability to support vertical display of var names might be a worthy request for SAS developers.&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 18:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765465#M242470</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-09-01T18:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765527#M242482</link>
      <description>&lt;P&gt;Datasets do not have name in either horizontal or vertical orientation.&lt;/P&gt;
&lt;P&gt;You must be talking about some TOOL you are using the VIEW the dataset.&lt;/P&gt;
&lt;P&gt;What tool are you using?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 01:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765527#M242482</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-02T01:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765539#M242492</link>
      <description>No, it's about dataset. I'm not using any tool, its regular viewer window&lt;BR /&gt;inside the SAS.&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Sep 2021 03:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765539#M242492</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2021-09-02T03:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Variable name from horizontal to vertical in sas dataset (not in proc outputs)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765591#M242515</link>
      <description>&lt;P&gt;Here is a variant of my previous suggestion&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;using SASHELP.VCOLUMN instead of a dataset VARLIST created in a separate step&lt;/LI&gt;
&lt;LI&gt;using CALL EXECUTE, thus obviating the need for a temporary code file&lt;/LI&gt;
&lt;LI&gt;allowing for non-standard variable names&lt;/LI&gt;
&lt;LI&gt;inserting only&amp;nbsp;&lt;FONT face="courier new,courier"&gt;'0A'x&lt;/FONT&gt;&amp;nbsp;(instead of&amp;nbsp;&lt;FONT face="courier new,courier"&gt;'0D0A'x&lt;/FONT&gt;) between the letters of the variable name in the label, as this is sufficient to obtain the vertical display in SAS Universal Viewer (&lt;FONT face="courier new,courier"&gt;'0D'x&lt;/FONT&gt; works as well).&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create a new sample dataset */

options validvarname=any;

data have2;
input SUBJID $ AGE GENDER $ 'this is a 32-char. variable name'n;
cards;
001 42 F 9
;

/* Add the variable names as "vertical" labels */

%let ds=work.have2;

data _null_;
length ren $165;
set sashelp.vcolumn(where=(libname="%upcase(%scan(&amp;amp;ds,1,.))"
                         &amp;amp; memname="%upcase(%scan(&amp;amp;ds,2,.))")) end=last;
if _n_=1 then call execute("proc datasets lib=%scan(&amp;amp;ds,1,.) nolist; modify %scan(&amp;amp;ds,2,.); label");
ren=cats(nliteral(name),'="');
w=length(name);
do i=1 to w;
  ren=catt(ren,put(char(name,i),$hex2.));
  if i&amp;lt;w then ren=catt(ren,'0A');
end;
ren=catt(ren,'"x');
call execute(ren);
if last then call execute('; quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Sep 2021 10:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-name-from-horizontal-to-vertical-in-sas-dataset-not-in/m-p/765591#M242515</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-09-02T10:07:37Z</dc:date>
    </item>
  </channel>
</rss>

