<?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: When I proc transpose my data by group1 group2, why I get many blanks values? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743182#M232605</link>
    <description>&lt;P&gt;basically I need to transpose it so I can search through score1-score40 and&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.check if the first letter has changed within id,card and flag if it has&lt;/P&gt;&lt;P&gt;2. check if the first is same, but second changed within id, card and flag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this data doesn't make sense, but the real data and variables make sense to what is desired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have transposed data many times, but something I can't pinpoint is causing extra variables with blanks and score variable has no blanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 23 May 2021 01:10:02 GMT</pubDate>
    <dc:creator>sbopster</dc:creator>
    <dc:date>2021-05-23T01:10:02Z</dc:date>
    <item>
      <title>When I proc transpose my data by group1 group2, why I get many blanks values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743181#M232604</link>
      <description>&lt;PRE&gt;data have;&lt;BR /&gt;input ID 	Card 	SCORE $;&lt;BR /&gt;cards;&lt;BR /&gt;123 	1111 	AE 	&lt;BR /&gt;123 	1111 	AB &lt;BR /&gt;123 	1113 	AE &lt;BR /&gt;456 	2221 	AS &lt;BR /&gt;456 	2221 	BF &lt;BR /&gt;456 	2221 	BF &lt;BR /&gt;456 	2222 	DC 	&lt;BR /&gt;456 	2222 	BE &lt;BR /&gt;456 	2222 	DL &lt;BR /&gt;456 	2222 	BF &lt;BR /&gt;456 	2222 	DC 	&lt;BR /&gt;456 	2222 	BE &lt;BR /&gt;456 	2222 	DE 			&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;PROC TRANSPOSE DATA=HAVE OUT=WANT;&lt;BR /&gt;BY ID CARD;&lt;BR /&gt;VAR SCORE;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;The idea is this but much larger. One ID,CARD has up to 40 Scores, so I was expecting&lt;BR /&gt;about score1--score40, but I get significantly more and I can't replicate it here.&lt;BR /&gt;&lt;BR /&gt;id card score1--score40&lt;BR /&gt;123 1111&lt;BR /&gt;123 1113&lt;BR /&gt;456 2221&lt;BR /&gt;456 2222&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 00:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743181#M232604</guid>
      <dc:creator>sbopster</dc:creator>
      <dc:date>2021-05-23T00:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: When I proc transpose my data by group1 group2, why I get many blanks values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743182#M232605</link>
      <description>&lt;P&gt;basically I need to transpose it so I can search through score1-score40 and&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.check if the first letter has changed within id,card and flag if it has&lt;/P&gt;&lt;P&gt;2. check if the first is same, but second changed within id, card and flag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this data doesn't make sense, but the real data and variables make sense to what is desired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have transposed data many times, but something I can't pinpoint is causing extra variables with blanks and score variable has no blanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 01:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743182#M232605</guid>
      <dc:creator>sbopster</dc:creator>
      <dc:date>2021-05-23T01:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: When I proc transpose my data by group1 group2, why I get many blanks values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743183#M232606</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/335826"&gt;@sbopster&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;basically I need to transpose it so I can search through score1-score40 and&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.check if the first letter has changed within id,card and flag if it has&lt;/P&gt;
&lt;P&gt;2. check if the first is same, but second changed within id, card and flag.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this data doesn't make sense, but the real data and variables make sense to what is desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have transposed data many times, but something I can't pinpoint is causing extra variables with blanks and score variable has no blanks.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That test is going to be much harder after the transpose.&lt;/P&gt;
&lt;P&gt;It is not at all clear what you want to do but let's assume that first you need to test if the first letter has changed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID Card SCORE $;
cards;
123 1111 AE
123 1111 AB
123 1113 AE
456 2221 AS
456 2221 BF
456 2221 BF
456 2222 DC
456 2222 BE
456 2222 DL
456 2222 BF
456 2222 DC
456 2222 BE
456 2222 DE
;

data want;
  set have;
  by id card;
  change = char(score,1) ne: lag(score);
  if first.card then change=0 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs     ID    Card    SCORE    change

  1    123    1111     AE         0
  2    123    1111     AB         0
  3    123    1113     AE         0
  4    456    2221     AS         0
  5    456    2221     BF         1
  6    456    2221     BF         0
  7    456    2222     DC         0
  8    456    2222     BE         1
  9    456    2222     DL         1
 10    456    2222     BF         1
 11    456    2222     DC         1
 12    456    2222     BE         1
 13    456    2222     DE         1
&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 May 2021 01:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743183#M232606</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-23T01:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: When I proc transpose my data by group1 group2, why I get many blanks values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743184#M232607</link>
      <description>&lt;P&gt;If you are getting more observations per group than you expected then your grouping variables are not unique.&lt;/P&gt;
&lt;P&gt;It might be there are a lot of observations with missing values or one or both of your key variables.&lt;/P&gt;
&lt;P&gt;It might be your variables are too short. Or you tried to stuff a 20 digit string into a number instead of character variable.&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 01:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-I-proc-transpose-my-data-by-group1-group2-why-I-get-many/m-p/743184#M232607</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-23T01:54:00Z</dc:date>
    </item>
  </channel>
</rss>

