<?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: How do I create labels for more than 400 variables !? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254085#M48417</link>
    <description>&lt;P&gt;It worked. Thank you. Could you please brief me a little theortical explanation on&amp;nbsp;your solution ?&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2016 08:26:28 GMT</pubDate>
    <dc:creator>pradeepvaranasi</dc:creator>
    <dc:date>2016-03-03T08:26:28Z</dc:date>
    <item>
      <title>How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254070#M48409</link>
      <description>&lt;P&gt;I have two excel files. One has the data set with 10000 rows &amp;amp; more than 400 variables. Second&amp;nbsp;excel file has data dictionary with variable name (in first excel file) &amp;amp; labels. How can I label all my variables at one go with in SAS ?&amp;nbsp;&lt;BR /&gt;The conventional method which I know is the below which is time taking and hectic for all 400 variables.&lt;BR /&gt;data work.Sample ;&lt;BR /&gt;set class1.TestData;&lt;BR /&gt;label storeid = 'Store ID';&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;label storeName = 'Name of the store';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;.....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have intermidiate knowledge in Proc SQL &amp;amp; Macros. Please advise.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 07:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254070#M48409</guid>
      <dc:creator>pradeepvaranasi</dc:creator>
      <dc:date>2016-03-03T07:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254071#M48410</link>
      <description>IMO having a data set with 400 variables makes little sense.&lt;BR /&gt;I would transpose it and potentially normalize the data structure. Then you could either build formats from or join your data dictionary with the "One" data set.</description>
      <pubDate>Thu, 03 Mar 2016 07:18:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254071#M48410</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-03-03T07:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254074#M48412</link>
      <description>Thank you LinusH. I have another one, even if I normalize &amp;amp; apply joins, how can label be associated with variables ? don't we use the label statement ?</description>
      <pubDate>Thu, 03 Mar 2016 07:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254074#M48412</guid>
      <dc:creator>pradeepvaranasi</dc:creator>
      <dc:date>2016-03-03T07:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254076#M48414</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
 set sashelp.class;
run;





data meta;
input name : $20. label  $40.;
cards;
sex asfasd sdfasdf
name sfsefl
;
run;
data _null_;
 set meta end=last;
 if _n_ eq 1 then call execute('proc datasets library=work nolist nodetails; modify have; label');
 call execute(cats(name,'="',label,'"'));
 if last then call execute(';quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Mar 2016 07:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254076#M48414</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-03T07:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254077#M48415</link>
      <description>If make rows fro columns your intended labels for column names are now values on rows  (some, perhaps not all). Hence SAS formats or joining your labels will the appropriate action.</description>
      <pubDate>Thu, 03 Mar 2016 07:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254077#M48415</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-03-03T07:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254078#M48416</link>
      <description>&lt;P&gt;Thank you LinusH &amp;amp; Ksharp. Working on Ksharp's&amp;nbsp;solution.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 07:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254078#M48416</guid>
      <dc:creator>pradeepvaranasi</dc:creator>
      <dc:date>2016-03-03T07:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254085#M48417</link>
      <description>&lt;P&gt;It worked. Thank you. Could you please brief me a little theortical explanation on&amp;nbsp;your solution ?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 08:26:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254085#M48417</guid>
      <dc:creator>pradeepvaranasi</dc:creator>
      <dc:date>2016-03-03T08:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254096#M48418</link>
      <description>&lt;P&gt;Once you saw the sas code generated by SAS in LOG, You will know what I am trying to do .&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 09:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254096#M48418</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-03T09:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254101#M48420</link>
      <description>&lt;P&gt;I would agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH﻿&lt;/a&gt;&amp;nbsp;here. &amp;nbsp;A normlised table will be far easier to work with. &amp;nbsp;400 clumns isn't much use to anyone, and reviewers will not look at so much data (I personally rarely even scroll the window in Excel!).&lt;/P&gt;
&lt;P&gt;I provide and example of what is meant by transposing and merging below, note its a simple example - if you have mixed number/character you will need to convert one or the other, or have two columns, one for character one for numeric. &amp;nbsp;But the theory is the same. &amp;nbsp;Its plain base code, no generation or anything, so easier to maintain. &amp;nbsp;Also, most of the information you need will be in your data transfer agreement will it not?&lt;/P&gt;
&lt;PRE&gt;/* Simulate data from spreadsheets */
data have;
  id=1; abc=1; def=2; abc1=5; fggh=3; uiui=7; qwer=8; opii=45; output;
  id=2; abc=1; def=2; abc1=5; fggh=3; uiui=7; qwer=8; opii=45; output;
run;
 
data labels;
  length var label $100;
  var="abc"; label="A label for abc"; output;
  var="def"; label="A label for def"; output;
  var="abc1"; label="A label for abc1"; output;
  var="fggh"; label="A label for fggh"; output;
  var="uiui"; label="A label for uiui"; output;
run;

/* Normalise the base data */
proc transpose data=have out=inter;
  by id;
  var _all_;
run;

/* Join lables on */
proc sql;
  create table WANT as
  select  A.*,
          B.LABEL
  from    WORK.INTER A
  left join WORK.LABELS B
  on      A._NAME_=B.VAR;
quit;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Mar 2016 09:34:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254101#M48420</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-03T09:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create labels for more than 400 variables !?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254107#M48421</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;. Would certainly try this method of transposing &amp;amp; merging too.</description>
      <pubDate>Thu, 03 Mar 2016 09:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-labels-for-more-than-400-variables/m-p/254107#M48421</guid>
      <dc:creator>pradeepvaranasi</dc:creator>
      <dc:date>2016-03-03T09:49:40Z</dc:date>
    </item>
  </channel>
</rss>

