<?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: questions about label in data set in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23896#M5367</link>
    <description>Hi:&lt;BR /&gt;
  I would just never attempt to duplicate what _N_ is doing in PROC SQL. If I were going to try to assign a number to every row that I create, I would do it in the first DATA step program:&lt;BR /&gt;
[pre]&lt;BR /&gt;
** 1) set macro variable for var1 label;&lt;BR /&gt;
%let v1labl = azertugughu;&lt;BR /&gt;
    &lt;BR /&gt;
** 2) create data, increment counter and use macro variable;&lt;BR /&gt;
data tabinit;&lt;BR /&gt;
  retain i 0;&lt;BR /&gt;
  label var1="&amp;amp;v1labl"&lt;BR /&gt;
        i = 'Number for Obs';&lt;BR /&gt;
  format var1 $50.;&lt;BR /&gt;
   &lt;BR /&gt;
  var1="G1*G2";&lt;BR /&gt;
  i+1;         /* increment i before output statement */&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="G3*G2*G1";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="G2*G3";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="youpi";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="G1*G3";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
** 3) use PROC PRINT;&lt;BR /&gt;
proc print data=tabinit label;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
   &lt;BR /&gt;
And the output from the PROC PRINT is:&lt;BR /&gt;
[pre]&lt;BR /&gt;
            Number&lt;BR /&gt;
    Obs    for Obs    azertugughu&lt;BR /&gt;
            &lt;BR /&gt;
     1        1       G1*G2&lt;BR /&gt;
     2        2       G3*G2*G1&lt;BR /&gt;
     3        3       G2*G3&lt;BR /&gt;
     4        4       youpi&lt;BR /&gt;
     5        5       G1*G3&lt;BR /&gt;
                                                                 &lt;BR /&gt;
[/pre]&lt;BR /&gt;
             &lt;BR /&gt;
                                      &lt;BR /&gt;
cynthia</description>
    <pubDate>Fri, 06 Jun 2008 17:21:48 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2008-06-06T17:21:48Z</dc:date>
    <item>
      <title>questions about label in data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23895#M5366</link>
      <description>Hello&lt;BR /&gt;
thank you cynthia for your answer at my last question.&lt;BR /&gt;
I have now 2 new questions;&lt;BR /&gt;
what is the equivalent code in proc sql for that :&lt;BR /&gt;
imagine i have this dataset :&lt;BR /&gt;
&lt;BR /&gt;
data tabinit;&lt;BR /&gt;
format var1 $50.;&lt;BR /&gt;
var1="G1*G2";&lt;BR /&gt;
output;&lt;BR /&gt;
var1="G3*G2*G1";&lt;BR /&gt;
output;&lt;BR /&gt;
var1="G2*G3";&lt;BR /&gt;
output;&lt;BR /&gt;
var1="youpi";&lt;BR /&gt;
output;&lt;BR /&gt;
var1="G1*G3";&lt;BR /&gt;
output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
and i do a data step :&lt;BR /&gt;
data tabinit2;&lt;BR /&gt;
  set tabinit;&lt;BR /&gt;
  i=_n_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
i am  sure that i can do the last data step with proc sql but i cannot remenber the equivalent fonction of _n_ in proc sql for creating a new variable with the number of the rows inside.&lt;BR /&gt;
thank you.&lt;BR /&gt;
&lt;BR /&gt;
and my second question :&lt;BR /&gt;
data tabinit3;&lt;BR /&gt;
set tabinit;&lt;BR /&gt;
miaou="azertugughu";&lt;BR /&gt;
label var1=miaou;     ****&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** : the problem is that the label of var1 become "miaou" but i want that the label of var1 become what is written in the variable miaou : azertugughu !!!&lt;BR /&gt;
is there a way to achieve this please ?&lt;BR /&gt;
Thank you dear sas users</description>
      <pubDate>Fri, 06 Jun 2008 14:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23895#M5366</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T14:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: questions about label in data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23896#M5367</link>
      <description>Hi:&lt;BR /&gt;
  I would just never attempt to duplicate what _N_ is doing in PROC SQL. If I were going to try to assign a number to every row that I create, I would do it in the first DATA step program:&lt;BR /&gt;
[pre]&lt;BR /&gt;
** 1) set macro variable for var1 label;&lt;BR /&gt;
%let v1labl = azertugughu;&lt;BR /&gt;
    &lt;BR /&gt;
** 2) create data, increment counter and use macro variable;&lt;BR /&gt;
data tabinit;&lt;BR /&gt;
  retain i 0;&lt;BR /&gt;
  label var1="&amp;amp;v1labl"&lt;BR /&gt;
        i = 'Number for Obs';&lt;BR /&gt;
  format var1 $50.;&lt;BR /&gt;
   &lt;BR /&gt;
  var1="G1*G2";&lt;BR /&gt;
  i+1;         /* increment i before output statement */&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="G3*G2*G1";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="G2*G3";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="youpi";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
  var1="G1*G3";&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
** 3) use PROC PRINT;&lt;BR /&gt;
proc print data=tabinit label;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
   &lt;BR /&gt;
And the output from the PROC PRINT is:&lt;BR /&gt;
[pre]&lt;BR /&gt;
            Number&lt;BR /&gt;
    Obs    for Obs    azertugughu&lt;BR /&gt;
            &lt;BR /&gt;
     1        1       G1*G2&lt;BR /&gt;
     2        2       G3*G2*G1&lt;BR /&gt;
     3        3       G2*G3&lt;BR /&gt;
     4        4       youpi&lt;BR /&gt;
     5        5       G1*G3&lt;BR /&gt;
                                                                 &lt;BR /&gt;
[/pre]&lt;BR /&gt;
             &lt;BR /&gt;
                                      &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 06 Jun 2008 17:21:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23896#M5367</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-06-06T17:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: questions about label in data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23897#M5368</link>
      <description>thank you for your answer but i try to find a way to create the label without a macro-variable like what i try to do in my last data-step. is it possible ? &lt;BR /&gt;
in fact my aim is to work with the most special characters.&lt;BR /&gt;
@+</description>
      <pubDate>Mon, 09 Jun 2008 08:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23897#M5368</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-09T08:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: questions about label in data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23898#M5369</link>
      <description>Hi montpe,&lt;BR /&gt;
           It is possible only with macro ,if you want to include some special charecters in the label then include the value in %STR function.</description>
      <pubDate>Mon, 09 Jun 2008 11:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/questions-about-label-in-data-set/m-p/23898#M5369</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-09T11:59:44Z</dc:date>
    </item>
  </channel>
</rss>

