<?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: Assigning levels to a variable at input in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808214#M39751</link>
    <description>&lt;P&gt;Not sure what this means:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input rows(*);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Looks a little like a reference to an array, but there is no ARRAY statement in the data step.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now is there any need for an ARRAY.&amp;nbsp; If you want to input multiple variables just list them in the INPUT statement.&amp;nbsp; If the names use sequential numeric suffixes then use a variable list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DO statement allows you to list multiple values (actually multiple sets of values) separated by commas.&lt;/P&gt;
&lt;P&gt;So if you wanted to name your variables ROWS1, ROWS2, ... ROWS10 then you could do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA ch;
  INFILE "C-location" truncover;
  length treat $ 7;
  do treat='A','B','C';
    input rows1-rows10;
    output;
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if the variables have more meaningful names then just list them in the INPUT statement, no need to define an ARRAY.&lt;/P&gt;</description>
    <pubDate>Sun, 17 Apr 2022 02:02:59 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-04-17T02:02:59Z</dc:date>
    <item>
      <title>Assigning levels to a variable at input</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808203#M39747</link>
      <description>&lt;P&gt;Hello!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a notepad set of data which contains 3 rows by 10 columns of numbers&lt;/P&gt;&lt;P&gt;Usually I would have the identifier on the first column but in this case there is not one&lt;/P&gt;&lt;P&gt;when I do this I get 3 sets of every row with all the A/B/C levels instead of just getting each row paired to their level.&lt;/P&gt;&lt;P&gt;Or should I take a different approach?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DATA ch;
	INFILE "C-location";
	input row1-row10;
	length treat $ 7;
	do i=1 to 3;
	if i=1 then treat='A';
	else if i=2 then treat= 'B';
	else treat= 'C';
	output;
	end;
	
RUN;

PROC PRINT data=ch;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 21:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808203#M39747</guid>
      <dc:creator>Mruizv</dc:creator>
      <dc:date>2022-04-16T21:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning levels to a variable at input</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808205#M39748</link>
      <description>&lt;P&gt;Not sure what you are asking for.&amp;nbsp; Sounds like you have text files with three lines and each line has 10 values delimited by spaces.&lt;/P&gt;
&lt;P&gt;So if those 10 values are 10 different variables then just use something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'myfile.txt' truncover;
  row+1;
  input var1-var10;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will create a dataset with 11 variables where ROW represents which line the value was on and VAR1 to VAR10 are the 10 variables.&amp;nbsp; The SUM statement will increment ROW for every observation read.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 22:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808205#M39748</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-16T22:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning levels to a variable at input</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808206#M39749</link>
      <description>&lt;P&gt;Changed the input to inside the do loop and it did the trick.&lt;/P&gt;&lt;P&gt;Needed the extra variable at the beginning but with specific value A B C one per row&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DATA ch;
	INFILE "C-location";
	length treat $ 7;
		do i=1 to 3;
		input rows(*);
		if i=1 then treat='A';
		else if i=2 then treat= 'B';
		else treat= 'C';
		output;
		end;
	drop i;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Apr 2022 22:50:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808206#M39749</guid>
      <dc:creator>Mruizv</dc:creator>
      <dc:date>2022-04-16T22:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning levels to a variable at input</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808211#M39750</link>
      <description>&lt;P&gt;It sounds like you could simplify the process down to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA ch;
   INFILE "C-location";
   length treat $ 7;
   do treat='A', 'B', 'C';
      input rows(*);
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Of course,&amp;nbsp; you would need to add the array definition for ROWS, and possibly the TRUNCOVER option to the INFILE statement.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2022 00:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808211#M39750</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-04-17T00:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning levels to a variable at input</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808214#M39751</link>
      <description>&lt;P&gt;Not sure what this means:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input rows(*);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Looks a little like a reference to an array, but there is no ARRAY statement in the data step.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now is there any need for an ARRAY.&amp;nbsp; If you want to input multiple variables just list them in the INPUT statement.&amp;nbsp; If the names use sequential numeric suffixes then use a variable list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DO statement allows you to list multiple values (actually multiple sets of values) separated by commas.&lt;/P&gt;
&lt;P&gt;So if you wanted to name your variables ROWS1, ROWS2, ... ROWS10 then you could do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA ch;
  INFILE "C-location" truncover;
  length treat $ 7;
  do treat='A','B','C';
    input rows1-rows10;
    output;
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if the variables have more meaningful names then just list them in the INPUT statement, no need to define an ARRAY.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2022 02:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Assigning-levels-to-a-variable-at-input/m-p/808214#M39751</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-17T02:02:59Z</dc:date>
    </item>
  </channel>
</rss>

