<?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: Proc transpose using array in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679223#M79427</link>
    <description>How does SAS know that though? Are you manually coding that lookup or is it just in a text file or in your head?&lt;BR /&gt;You need to find a way to make that part of your process which means making it part of your program in some fashion which means getting the data into SAS somehow.</description>
    <pubDate>Tue, 25 Aug 2020 17:33:30 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-08-25T17:33:30Z</dc:date>
    <item>
      <title>Proc transpose using array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679210#M79424</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am trying to transpose a wide data set to a long dataset and found some sas code that uses an array; I tested it out using three variables and it worked well.&amp;nbsp; The issue I have is that the zip codes are not all consecutive, for example, I have 60601 to 60620, but then it jumps to 60625 to 60640; most are consecutive but several are not.&amp;nbsp; How do I specify that in the array?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;PRE&gt;data WORK.TRANSPOSE;
  infile datalines dsd truncover;
  input Date:DATE9. Percent:32. Percent1:32. Percent2:32.;
  format Date DATE9.;
  datalines;
01JAN2020 16.667 0 0
02JAN2020 0 0 0
03JAN2020 14.286 0 0
04JAN2020 0 0 0
05JAN2020 0 0 0
06JAN2020 0 0 0
07JAN2020 0 0 0
08JAN2020 0 0 0
09JAN2020 20 0 0
10JAN2020 0 0 0
11JAN2020 0 0 0
12JAN2020 0 0 0
13JAN2020 0 0 0
14JAN2020 0 0 0
15JAN2020 0 0 0
16JAN2020 25 0 0
17JAN2020 0 0 0
18JAN2020 0 0 0
19JAN2020 0 0 0
20JAN2020 0 0 0
;;;;

data Transpose2; set transpose;

	array apctcli(60601:60603) Percent Percent1 Percent2;

	do zip = 60601 to 60603;
	pctcli =  apctcli(zip);
	output;
	END;

	DROP Percent Percent1 Percent2;
	run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 17:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679210#M79424</guid>
      <dc:creator>eramirez</dc:creator>
      <dc:date>2020-08-25T17:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose using array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679214#M79425</link>
      <description>I would argue this isn't a good way to transpose. You're relying on location of the data to be the correct variable?&lt;BR /&gt;&lt;BR /&gt;How do you know percent1 maps to 60601?&lt;BR /&gt;Where is that information stored?</description>
      <pubDate>Tue, 25 Aug 2020 17:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679214#M79425</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-25T17:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose using array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679222#M79426</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp; You are correct, I am relying on location, but in this case, Percent will always be 60601, Percent1 will always be 60602 and so on and they will always be in the same location.&amp;nbsp; It is based on a data dictionary.&amp;nbsp; Unfortunately, that is how the data is downloaded and sent to me.&amp;nbsp; Actually, there are five values associated with each zip code and numbered the same way.&amp;nbsp; For example, there is Percent1, Count1, Expected1, and all are associated with 60602. It's annoying, but it's what I have to work with.&amp;nbsp; If you have a more efficient way to transpose I am definitely open to that!&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 17:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679222#M79426</guid>
      <dc:creator>eramirez</dc:creator>
      <dc:date>2020-08-25T17:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose using array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679223#M79427</link>
      <description>How does SAS know that though? Are you manually coding that lookup or is it just in a text file or in your head?&lt;BR /&gt;You need to find a way to make that part of your process which means making it part of your program in some fashion which means getting the data into SAS somehow.</description>
      <pubDate>Tue, 25 Aug 2020 17:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679223#M79427</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-25T17:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose using array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679232#M79428</link>
      <description>I am not really following, I'm sorry. How does SAS know what? The data was imported into SAS and it's a SAS dataset with those variable names, except for Zip which I created.</description>
      <pubDate>Tue, 25 Aug 2020 18:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679232#M79428</guid>
      <dc:creator>eramirez</dc:creator>
      <dc:date>2020-08-25T18:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose using array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679240#M79429</link>
      <description>How does SAS know percent1 maps to 60601 and percent9 maps to 90210 for example? Do you have a lookup table with that information?</description>
      <pubDate>Tue, 25 Aug 2020 18:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-transpose-using-array/m-p/679240#M79429</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-25T18:24:06Z</dc:date>
    </item>
  </channel>
</rss>

