<?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 to label a large number of variables according to a sequential pattern in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649620#M194790</link>
    <description>&lt;P&gt;I have a very hard time visualizing where that many variables would be desirable. Without very important reasons I would likely Transpose the data to one record per time period and then Create a time variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something along these lines:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   array v var1 - var2880 ;
   count=1;
   do time= "00:00:00"t to "23:59:30"t by 30;
      value = v[count];
      output;
      count=count+1;
   end;
   keep /* other needed variables go here*/ time value;
   format time time8.;
run;
&lt;/PRE&gt;
&lt;P&gt;Or even read the source date differently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 May 2020 15:59:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-05-21T15:59:15Z</dc:date>
    <item>
      <title>How to label a large number of variables according to a sequential pattern</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649565#M194762</link>
      <description>&lt;P&gt;I have a dataset that has a large number of variables (2,880 to be exact). Right now, the variables have the default variable names var1, var2, var3, ..., var2880. I need to label the variables according to 30 second intervals of military time - 00:00:00, 00:00:30, 00:01:00, 00:01:30, 00:02:00,...,23:59:30. I'm trying to figure out a way to do this without having to type all 2,880 by hand. I was thinking of using an array somehow, but I don't have a list of the desired labels stored anywhere, so I would still have to hand type them into the array. Any suggestions are appreciated!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 13:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649565#M194762</guid>
      <dc:creator>tmcwill</dc:creator>
      <dc:date>2020-05-21T13:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to label a large number of variables according to a sequential pattern</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649570#M194765</link>
      <description>&lt;P&gt;here's my code to do this for 3 variables, obviously its easy to change for 2880 variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* I created a data set for me to work with, you don't have to do this step */
data have;
    var1=0;
	var2=0;
	var3=0;
run;

%macro dothis;
	proc datasets library=work /* or you can use another library */ nolist;
	    modify have; /* Your actual data set name goes here */
  		%do i=1 %to 3;
			%let seconds=%eval((&amp;amp;i-1)*30);
		    %let thistime=%sysfunc(putn(&amp;amp;seconds,time8.));
/*			%put &amp;amp;=i &amp;amp;=seconds &amp;amp;=thistime;*/
			label var&amp;amp;i = "&amp;amp;thistime";
		%end;
	run; quit;
%mend;
%dothis&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 May 2020 14:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649570#M194765</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-05-21T14:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to label a large number of variables according to a sequential pattern</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649620#M194790</link>
      <description>&lt;P&gt;I have a very hard time visualizing where that many variables would be desirable. Without very important reasons I would likely Transpose the data to one record per time period and then Create a time variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something along these lines:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   array v var1 - var2880 ;
   count=1;
   do time= "00:00:00"t to "23:59:30"t by 30;
      value = v[count];
      output;
      count=count+1;
   end;
   keep /* other needed variables go here*/ time value;
   format time time8.;
run;
&lt;/PRE&gt;
&lt;P&gt;Or even read the source date differently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 15:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649620#M194790</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-21T15:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to label a large number of variables according to a sequential pattern</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649670#M194808</link>
      <description>&lt;P&gt;A good suggestion for most situations.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 18:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-a-large-number-of-variables-according-to-a/m-p/649670#M194808</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-05-21T18:09:20Z</dc:date>
    </item>
  </channel>
</rss>

