<?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: DataStep help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49447#M10265</link>
    <description>I feel INCREDIBLY stupid...in my X years of experience I never had the need and assumed that there was a limitation to the # of fields to put on the by field in PROC TRANSPOSE.  I am not even going to embarrass myself by telling how many years of SAS exp I have.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Yes this seems to have done the trick... &lt;BR /&gt;
&lt;BR /&gt;
May I trouble with a follow up question I am trying to build a catx function&lt;BR /&gt;
&lt;BR /&gt;
   AGTLIST = CATX (',',COL1,COL2,COL3,COL4....); &lt;BR /&gt;
This code will be in production. I want it to be dynamic… I am doing something wrong.&lt;BR /&gt;
&lt;BR /&gt;
%MACRO CATX_STR;&lt;BR /&gt;
DATA TESTCODE2;&lt;BR /&gt;
   SET TESTCODE;&lt;BR /&gt;
   AGTLIST = CATX(',',&lt;BR /&gt;
%DO I = 1 %TO &amp;amp;MAX_AGTS;&lt;BR /&gt;
agt&amp;amp;I , &lt;BR /&gt;
%END;&lt;BR /&gt;
);;&lt;BR /&gt;
   RUN;&lt;BR /&gt;
%MEND CATX_STR;&lt;BR /&gt;
%CATX_STR;</description>
    <pubDate>Mon, 13 Dec 2010 21:10:42 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-12-13T21:10:42Z</dc:date>
    <item>
      <title>DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49442#M10260</link>
      <description>Can someone please help&lt;BR /&gt;
&lt;BR /&gt;
I have the following scenerio.I need to create 2 rows out of this data and to put the agt # in one row.   I have thousands of these types of records, whats more is my mind is a blank.  I figure I need to use call execute but frankly am just stomped. Would appreciate any suggestions.  Thanks Lisa&lt;BR /&gt;
&lt;BR /&gt;
Entered      Br  Grp   Name               id       srvc Br  Agt #&lt;BR /&gt;
11/03/2010 LA  CP    Lisa Eberman    12345    LA    6782&lt;BR /&gt;
11/03/2010 LA  CP    Lisa Eberman    12345    LA    6166&lt;BR /&gt;
11/03/2010 LA  RP    Lisa Eberman    12345    LA    6686&lt;BR /&gt;
11/03/2010 LA  RP    Lisa Eberman    12345    LA    6633&lt;BR /&gt;
11/03/2010 LA  RP    Lisa Eberman    12345    LA    73660&lt;BR /&gt;
11/03/2010 LA  RP    Lisa Eberman    12345    LA    6231&lt;BR /&gt;
11/03/2010 LA  AP    Lisa Eberman    12345    LA    1234&lt;BR /&gt;
&lt;BR /&gt;
11/03/2010 NY  RP    Ella Temp         56789    LA    6231&lt;BR /&gt;
11/03/2010 NY  RP    Ella Temp         56789    LA    6232&lt;BR /&gt;
&lt;BR /&gt;
11/03/2010 NY  MM    Mark Wise       09876    NY    64621&lt;BR /&gt;
11/03/2010 NY  MM    Mark Wise       09876    NY    64605&lt;BR /&gt;
11/03/2010 NY  MM    Mark Wise       09876    NY    64589&lt;BR /&gt;
11/03/2010 NY  MM    Mark Wise       09876    NY    64588&lt;BR /&gt;
11/03/2010 NY  MM    Mark Wise       09876    NY    64586&lt;BR /&gt;
&lt;BR /&gt;
11/03/2010 NY  AB    Liza White       19876     XY    64588&lt;BR /&gt;
11/03/2010 NY  AB    Liza White        19876    XY    64586</description>
      <pubDate>Mon, 13 Dec 2010 19:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49442#M10260</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-12-13T19:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49443#M10261</link>
      <description>Duhhh-&lt;BR /&gt;
&lt;BR /&gt;
What I want it to look like is like this...&lt;BR /&gt;
11/03/2010  LA  CP  Lisa Eberman  12345   LA    6782,6166&lt;BR /&gt;
11/03/2010  LA  RP  Lisa Eberman  12345   LA    6686,6633,73660,6231&lt;BR /&gt;
11/03/2010  LA  AP  Lisa Eberman  12345   LA    1234                        &lt;BR /&gt;
11/03/2010  NY  RP  Ella Temp     56789     LA    6231,6232                        &lt;BR /&gt;
11/03/2010  NY  MM  Mark Wise     9876    NY    64621,64605,64589,64588,64586&lt;BR /&gt;
 11/03/2010  NY  AB  Liza White    19876    XY    64588,64586</description>
      <pubDate>Mon, 13 Dec 2010 19:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49443#M10261</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-12-13T19:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49444#M10262</link>
      <description>Consider using PROC TRANSPOSE to get to a "horizontal output condition" for your Agt# variable.  Then you can use a SAS DATA step to create a concatenated string of all Agt# variables, using a SAS assignment statement and also using the CATX(',' OF AGT#: ) function - set the LENGTH of your concatenated Agt# values first.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
catx function concatenate data values site:sas.com</description>
      <pubDate>Mon, 13 Dec 2010 20:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49444#M10262</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-12-13T20:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49445#M10263</link>
      <description>What I actually did is put all those fields (minus the Agt #) into a large field and did the proc transpose as you mentioned. But I think that there has got to be a better way.</description>
      <pubDate>Mon, 13 Dec 2010 20:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49445#M10263</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-12-13T20:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49446#M10264</link>
      <description>Hello LisaEb,&lt;BR /&gt;
&lt;BR /&gt;
Is this what you need?:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data i;&lt;BR /&gt;
input Entered mmddyy10. Br $ Grp $ Name1 $ Name2 $ id srvc $ Agt;&lt;BR /&gt;
format Entered date7.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
11/03/2010 LA CP Lisa Eberman 12345 LA 6782&lt;BR /&gt;
11/03/2010 LA CP Lisa Eberman 12345 LA 6166&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman 12345 LA 6686&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman 12345 LA 6633&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman 12345 LA 73660&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman 12345 LA 6231&lt;BR /&gt;
11/03/2010 LA AP Lisa Eberman 12345 LA 1234&lt;BR /&gt;
11/03/2010 NY RP Ella Temp 56789 LA 6231&lt;BR /&gt;
11/03/2010 NY RP Ella Temp 56789 LA 6232&lt;BR /&gt;
11/03/2010 NY MM Mark Wise 09876 NY 64621&lt;BR /&gt;
11/03/2010 NY MM Mark Wise 09876 NY 64605&lt;BR /&gt;
11/03/2010 NY MM Mark Wise 09876 NY 64589&lt;BR /&gt;
11/03/2010 NY MM Mark Wise 09876 NY 64588&lt;BR /&gt;
11/03/2010 NY MM Mark Wise 09876 NY 64586&lt;BR /&gt;
11/03/2010 NY AB Liza White 19876 XY 64588&lt;BR /&gt;
11/03/2010 NY AB Liza White 19876 XY 64586 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=i out=s;&lt;BR /&gt;
  by Entered Br Grp Name1 Name2 id srvc;&lt;BR /&gt;
run; &lt;BR /&gt;
proc transpose data=s out=r(drop=_name_) prefix=Agt;&lt;BR /&gt;
  var agt;&lt;BR /&gt;
  by Entered Br Grp Name1 Name2 id srvc; &lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Mon, 13 Dec 2010 20:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49446#M10264</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2010-12-13T20:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49447#M10265</link>
      <description>I feel INCREDIBLY stupid...in my X years of experience I never had the need and assumed that there was a limitation to the # of fields to put on the by field in PROC TRANSPOSE.  I am not even going to embarrass myself by telling how many years of SAS exp I have.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Yes this seems to have done the trick... &lt;BR /&gt;
&lt;BR /&gt;
May I trouble with a follow up question I am trying to build a catx function&lt;BR /&gt;
&lt;BR /&gt;
   AGTLIST = CATX (',',COL1,COL2,COL3,COL4....); &lt;BR /&gt;
This code will be in production. I want it to be dynamic… I am doing something wrong.&lt;BR /&gt;
&lt;BR /&gt;
%MACRO CATX_STR;&lt;BR /&gt;
DATA TESTCODE2;&lt;BR /&gt;
   SET TESTCODE;&lt;BR /&gt;
   AGTLIST = CATX(',',&lt;BR /&gt;
%DO I = 1 %TO &amp;amp;MAX_AGTS;&lt;BR /&gt;
agt&amp;amp;I , &lt;BR /&gt;
%END;&lt;BR /&gt;
);;&lt;BR /&gt;
   RUN;&lt;BR /&gt;
%MEND CATX_STR;&lt;BR /&gt;
%CATX_STR;</description>
      <pubDate>Mon, 13 Dec 2010 21:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49447#M10265</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-12-13T21:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49448#M10266</link>
      <description>As suggested, use the "OF" keyword with CATX function and a variable stem/prefix - shown below - also covered in the SAS 9.2 DOC on CATX:&lt;BR /&gt;
&lt;BR /&gt;
ALL_VALUES = CATX(',',OF COL: );&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.

Message was edited by: sbb</description>
      <pubDate>Mon, 13 Dec 2010 21:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49448#M10266</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-12-13T21:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49449#M10267</link>
      <description>Hi:&lt;BR /&gt;
  The CATX function will take a numbered list, as shown below. Do you need a macro program for some other reason?? &lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data coldata(keep=col1 col2 col3 sales);&lt;BR /&gt;
  length col1 col2 col3 $25;&lt;BR /&gt;
  set sashelp.shoes;&lt;BR /&gt;
  col1 = region;&lt;BR /&gt;
  col2 = subsidiary;&lt;BR /&gt;
  col3 = product;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
               &lt;BR /&gt;
data new;&lt;BR /&gt;
  length newvar $80;&lt;BR /&gt;
  set coldata;&lt;BR /&gt;
  newvar=catx(',',of col1-col3);&lt;BR /&gt;
run;&lt;BR /&gt;
        &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc print data=new;&lt;BR /&gt;
var newvar col1 col2 col3 sales;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 13 Dec 2010 21:44:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49449#M10267</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-12-13T21:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49450#M10268</link>
      <description>Hi.&lt;BR /&gt;
I have another way.Just to be a choice.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data i;&lt;BR /&gt;
input Entered mmddyy10. Br $ Grp $ Name &amp;amp; $20. id srvc $ Agt;&lt;BR /&gt;
format Entered mmddyy10.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
11/03/2010 LA CP Lisa Eberman  12345 LA 6782&lt;BR /&gt;
11/03/2010 LA CP Lisa Eberman  12345 LA 6166&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman  12345 LA 6686&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman  12345 LA 6633&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman  12345 LA 73660&lt;BR /&gt;
11/03/2010 LA RP Lisa Eberman  12345 LA 6231&lt;BR /&gt;
11/03/2010 LA AP Lisa Eberman  12345 LA 1234&lt;BR /&gt;
11/03/2010 NY RP Ella Temp  56789 LA 6231&lt;BR /&gt;
11/03/2010 NY RP Ella Temp  56789 LA 6232&lt;BR /&gt;
11/03/2010 NY MM Mark Wise  09876 NY 64621&lt;BR /&gt;
11/03/2010 NY MM Mark Wise  09876 NY 64605&lt;BR /&gt;
11/03/2010 NY MM Mark Wise  09876 NY 64589&lt;BR /&gt;
11/03/2010 NY MM Mark Wise  09876 NY 64588&lt;BR /&gt;
11/03/2010 NY MM Mark Wise  09876 NY 64586&lt;BR /&gt;
11/03/2010 NY AB Liza White  19876 XY 64588&lt;BR /&gt;
11/03/2010 NY AB Liza White  19876 XY 64586 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=i;&lt;BR /&gt;
 by entered br grp ;&lt;BR /&gt;
&lt;BR /&gt;
data result;&lt;BR /&gt;
 set i;&lt;BR /&gt;
 by entered br grp;&lt;BR /&gt;
 length whole $ 200;&lt;BR /&gt;
 retain whole;&lt;BR /&gt;
 if first.grp then call missing(whole);&lt;BR /&gt;
 whole=catx(',',whole,agt);&lt;BR /&gt;
 if last.grp then output;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print noobs; run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 14 Dec 2010 04:08:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49450#M10268</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-14T04:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: DataStep help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49451#M10269</link>
      <description>Hello LisaEb, &lt;BR /&gt;
&lt;BR /&gt;
There is a small mistake in your code, namely comma position is wrong. The correct code looks like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%MACRO CATX_STR;&lt;BR /&gt;
DATA TESTCODE2;&lt;BR /&gt;
SET TESTCODE;&lt;BR /&gt;
AGTLIST = CATX(','&lt;BR /&gt;
%DO I = 1 %TO &amp;amp;MAX_AGTS;&lt;BR /&gt;
,agt&amp;amp;I &lt;BR /&gt;
%END;&lt;BR /&gt;
);&lt;BR /&gt;
RUN;&lt;BR /&gt;
%MEND CATX_STR;&lt;BR /&gt;
%CATX_STR;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Tue, 14 Dec 2010 17:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DataStep-help/m-p/49451#M10269</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2010-12-14T17:29:49Z</dc:date>
    </item>
  </channel>
</rss>

