<?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 call catx in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/call-catx/m-p/22813#M4996</link>
    <description>hello,&lt;BR /&gt;
&lt;BR /&gt;
I took Doc's advice and changed the title, I have also took Scott's suggestion and used: PUTLOG _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
one thing that Scott did not mention was that using STOP after PUTLOG will stop that part of my program and nothing will happen afterward. So I ended up using only PUTLOG_ALL_;&lt;BR /&gt;
&lt;BR /&gt;
now my problem is I want to use CALL CATX function: to replace "+" with " " (space)&lt;BR /&gt;
&lt;BR /&gt;
my data is the following:&lt;BR /&gt;
L1_0+L1_13+L1_14&lt;BR /&gt;
&lt;BR /&gt;
I need to Remove the "+" (addition sign), replace it with blank " " and label the column MAIN to look like this in the column named MAIN&lt;BR /&gt;
&lt;BR /&gt;
L1_0 L1_13 L1_14&lt;BR /&gt;
&lt;BR /&gt;
The LOG result:&lt;BR /&gt;
NewParmAdd=L1_0+L1_13+L1_14 Main=L1_13 L1_14 &lt;BR /&gt;
&lt;BR /&gt;
NewParmAdd=L1_0+L1_13+L1_14&lt;BR /&gt;
Main=L1_13 L1_14&lt;BR /&gt;
&lt;BR /&gt;
This is the code I am using:&lt;BR /&gt;
&lt;BR /&gt;
%let numitem=10;&lt;BR /&gt;
%let numatt=4;&lt;BR /&gt;
&lt;BR /&gt;
CALL CATX(" ", Main, OF L1_11--L&amp;amp;numitem._1&amp;amp;numatt.);&lt;BR /&gt;
&lt;BR /&gt;
As you see the the old data (column) called NewParmAdd has L1_0+L1_13+L1_14 and the new data(column)  called MAIN has only L13 L1_14 while I wanted to have L1_13 L1_14 and L1_0&lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
R.A.G.</description>
    <pubDate>Sun, 06 Mar 2011 19:25:00 GMT</pubDate>
    <dc:creator>R_A_G_</dc:creator>
    <dc:date>2011-03-06T19:25:00Z</dc:date>
    <item>
      <title>call catx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/call-catx/m-p/22813#M4996</link>
      <description>hello,&lt;BR /&gt;
&lt;BR /&gt;
I took Doc's advice and changed the title, I have also took Scott's suggestion and used: PUTLOG _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
one thing that Scott did not mention was that using STOP after PUTLOG will stop that part of my program and nothing will happen afterward. So I ended up using only PUTLOG_ALL_;&lt;BR /&gt;
&lt;BR /&gt;
now my problem is I want to use CALL CATX function: to replace "+" with " " (space)&lt;BR /&gt;
&lt;BR /&gt;
my data is the following:&lt;BR /&gt;
L1_0+L1_13+L1_14&lt;BR /&gt;
&lt;BR /&gt;
I need to Remove the "+" (addition sign), replace it with blank " " and label the column MAIN to look like this in the column named MAIN&lt;BR /&gt;
&lt;BR /&gt;
L1_0 L1_13 L1_14&lt;BR /&gt;
&lt;BR /&gt;
The LOG result:&lt;BR /&gt;
NewParmAdd=L1_0+L1_13+L1_14 Main=L1_13 L1_14 &lt;BR /&gt;
&lt;BR /&gt;
NewParmAdd=L1_0+L1_13+L1_14&lt;BR /&gt;
Main=L1_13 L1_14&lt;BR /&gt;
&lt;BR /&gt;
This is the code I am using:&lt;BR /&gt;
&lt;BR /&gt;
%let numitem=10;&lt;BR /&gt;
%let numatt=4;&lt;BR /&gt;
&lt;BR /&gt;
CALL CATX(" ", Main, OF L1_11--L&amp;amp;numitem._1&amp;amp;numatt.);&lt;BR /&gt;
&lt;BR /&gt;
As you see the the old data (column) called NewParmAdd has L1_0+L1_13+L1_14 and the new data(column)  called MAIN has only L13 L1_14 while I wanted to have L1_13 L1_14 and L1_0&lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
R.A.G.</description>
      <pubDate>Sun, 06 Mar 2011 19:25:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/call-catx/m-p/22813#M4996</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-06T19:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: call catx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/call-catx/m-p/22814#M4997</link>
      <description>Look at the TRANSLATE function to manipulate your MAIN variable, I suppose.  &lt;BR /&gt;
&lt;BR /&gt;
Honestly, you're spoon-feeding information making it difficult to assist you --- paste the SASLOG intact with your code as well as SAS diagnostics revealed (COPY and PASTE).&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 07 Mar 2011 00:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/call-catx/m-p/22814#M4997</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-03-07T00:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: call catx</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/call-catx/m-p/22815#M4998</link>
      <description>Hi Scott;&lt;BR /&gt;
&lt;BR /&gt;
This is the part of log that relates to the code:&lt;BR /&gt;
Thank you&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
LOG:&lt;BR /&gt;
NewParmAdd=L3_0+L3_13+L3_14 Main=L3_13 L3_14 OrderMain=  Order12way=  Order22way=  Order13way=&lt;BR /&gt;
Order23way=  Order33way=  OrderMainMax=  Order12wayMax=  Order22wayMax=  Order13wayMax=&lt;BR /&gt;
Order23wayMax=  Order33wayMax=  class=16 item=3 scorepattern=30011 thresh=4 attpattern=0011&lt;BR /&gt;
classatt1=1 classatt2=1 classatt3=1 classatt4=1 itematt1=0 itematt2=0 itematt3=1 itematt4=1&lt;BR /&gt;
scoreatt1=0 scoreatt2=0 scoreatt3=1 scoreatt4=1 BeginS=. G_11=G_11 G_12=G_12 G_13=G_13 G_14=G_14&lt;BR /&gt;
EndS=. LongSParm=19 BeginI=. LInt=L3_0 L1_11=  L2_11=  L3_11=  L4_11=  L5_11=  L6_11=  L7_11=&lt;BR /&gt;
L8_11=  L9_11=  L10_11=  L11_11=  L12_11=  L13_11=  L14_11=  L15_11=  L1_12=  L2_12=  L3_12=&lt;BR /&gt;
L4_12=  L5_12=  L6_12=  L7_12=  L8_12=  L9_12=  L10_12=  L11_12=  L12_12=  L13_12=  L14_12=&lt;BR /&gt;
L15_12=  L1_13=  L2_13=  L3_13=L3_13 L4_13=  L5_13=  L6_13=  L7_13=  L8_13=  L9_13=  L10_13=&lt;BR /&gt;
L11_13=  L12_13=  L13_13=  L14_13=  L15_13=  L1_14=  L2_14=  L3_14=L3_14 L4_14=  L5_14=  L6_14=&lt;BR /&gt;
L7_14=  L8_14=  L9_14=  L10_14=  L11_14=  L12_14=  L13_14=  L14_14=  L15_14=  LastI=.&lt;BR /&gt;
LongIParm=16 LongOrderMain=. _ERROR_=0 _N_=33&lt;BR /&gt;
&lt;BR /&gt;
This is the code:&lt;BR /&gt;
%MACRO Equations (structorder, maxitemorder);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%let num_skills=4;&lt;BR /&gt;
%let numatt=4;&lt;BR /&gt;
%let numitem=%eval(2**&amp;amp;num_skills-1);&lt;BR /&gt;
%let numclass=%eval(2**&amp;amp;num_skills);&lt;BR /&gt;
%let IDname=num_student; &lt;BR /&gt;
%let numatt=&amp;amp;num_skills; /*change it to what ever value for skill*/&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA kernel;&lt;BR /&gt;
	/* Listing all character variables eventually created*/&lt;BR /&gt;
	LENGTH  NewStruc NewStrucAdd NewParm NewParmAdd &lt;BR /&gt;
			Main OrderMain Order12way Order22way&lt;BR /&gt;
			Order13way Order23way Order33way&lt;BR /&gt;
			OrderMainMax Order12wayMax Order22wayMax&lt;BR /&gt;
			Order13wayMax Order23wayMax Order33wayMax $500; &lt;BR /&gt;
	&lt;BR /&gt;
	SET kernel;&lt;BR /&gt;
/*** STRUCTURAL MODEL PARAMETERS*/&lt;BR /&gt;
/* Dummy variable to use as placeholder*/&lt;BR /&gt;
BeginS = .;&lt;BR /&gt;
	/* Main effects*/&lt;BR /&gt;
		%DO a=1 %TO &amp;amp;numatt.;&lt;BR /&gt;
			IF classatt&amp;amp;a.=1 THEN G_1&amp;amp;a.= "G_1&amp;amp;a.   "; &lt;BR /&gt;
				ELSE G_1&amp;amp;a. = G_1&amp;amp;a.;&lt;BR /&gt;
		%END;&lt;BR /&gt;
&lt;BR /&gt;
	* Last variable to use as dummy place;&lt;BR /&gt;
		EndS = .;&lt;BR /&gt;
	* Creating string variables to use in NEW equations;&lt;BR /&gt;
		CALL CATX(" ", NewStruc, OF BeginS--EndS);&lt;BR /&gt;
			NewStruc = TRANWRD(NewStruc, "." , " " );&lt;BR /&gt;
			NewStruc = STRIP(NewStruc);&lt;BR /&gt;
		NewStrucAdd = TRANWRD(STRIP(NewStruc), " " , "+" );&lt;BR /&gt;
	* Creating index for longest possible number of structural parms;&lt;BR /&gt;
		LongSParm = LENGTH(STRIP(NewStruc));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
* Saving longest parm as new variable for class reference statement;&lt;BR /&gt;
PROC SORT DATA=kernel; BY item DESCENDING LongSParm; RUN;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA SaveSLong; SET kernel; BY item;&lt;BR /&gt;
	IF FIRST.item THEN NewStrucMax=STRIP(NewStruc); ELSE DELETE; RUN;&lt;BR /&gt;
* Merge longest parm back into data;&lt;BR /&gt;
DATA kernel; LENGTH NewStrucMax NewStrucMaxAdd $200; MERGE SaveSLong kernel; BY item; &lt;BR /&gt;
	NewStrucMaxAdd = TRANWRD(STRIP(NewStrucMax), " " , "+" ); RUN;&lt;BR /&gt;
* Clearing extra datasets;&lt;BR /&gt;
PROC DATASETS LIB=WORK NOLIST; DELETE SaveSLong; RUN; QUIT;&lt;BR /&gt;
&lt;BR /&gt;
PROC SORT DATA=kernel; BY item thresh; RUN;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
* Re-opening data;&lt;BR /&gt;
DATA kernel; SET kernel;&lt;BR /&gt;
	*** ITEM PARAMETERS;&lt;BR /&gt;
	* Dummy variable to use as placeholder;&lt;BR /&gt;
	BeginI=.;&lt;BR /&gt;
&lt;BR /&gt;
	* Intercepts per item (1);&lt;BR /&gt;
		%DO i=1 %TO &amp;amp;numitem.; &lt;BR /&gt;
			IF item=&amp;amp;i. THEN LInt = "L&amp;amp;i._0    "; &lt;BR /&gt;
				ELSE LInt = LInt;&lt;BR /&gt;
		%END;&lt;BR /&gt;
&lt;BR /&gt;
	* Main effects per item (up to # attributes);&lt;BR /&gt;
		%DO Num1=1 %TO &amp;amp;numatt.;&lt;BR /&gt;
			%DO i=1 %TO &amp;amp;numitem.;&lt;BR /&gt;
				IF item=&amp;amp;i. AND scoreatt&amp;amp;Num1.=1 THEN L&amp;amp;i._1&amp;amp;Num1. = "L&amp;amp;i._1&amp;amp;Num1.    "; &lt;BR /&gt;
					ELSE L&amp;amp;i._1&amp;amp;Num1. = L&amp;amp;i._1&amp;amp;Num1.;&lt;BR /&gt;
			%END;&lt;BR /&gt;
		%END;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/* Last variable to use as dummy place to end series*/&lt;BR /&gt;
		LastI = .;&lt;BR /&gt;
/* Creating string variables to use in NEW equations*/&lt;BR /&gt;
&lt;BR /&gt;
CALL CATX(" ", NewParm, OF BeginI--LastI);&lt;BR /&gt;
			NewParm = TRANWRD(NewParm, "." , " " );&lt;BR /&gt;
			NewParm = STRIP(NewParm);&lt;BR /&gt;
		NewParmAdd = TRANWRD(STRIP(NewParm), " " , "+" );&lt;BR /&gt;
	* Creating index for longest possible number of parms;&lt;BR /&gt;
		LongIParm = LENGTH(STRIP(NewParm));&lt;BR /&gt;
RUN;&lt;BR /&gt;
* Saving longest parm as new variable for NEW statement;&lt;BR /&gt;
PROC SORT DATA=kernel; BY item DESCENDING LongIParm; RUN;&lt;BR /&gt;
DATA SaveILong; SET kernel; BY item; &lt;BR /&gt;
	IF FIRST.item THEN NewParmMax=NewParm; ELSE DELETE; RUN;&lt;BR /&gt;
* Merge longest parm back into data;&lt;BR /&gt;
DATA kernel; LENGTH NewParmMax $100; MERGE SaveILong kernel; BY item; RUN;&lt;BR /&gt;
* Clearing extra datasets;&lt;BR /&gt;
PROC DATASETS LIB=WORK NOLIST; DELETE SaveILong; RUN; QUIT;&lt;BR /&gt;
&lt;BR /&gt;
* Creating string variables for ordering constraints;&lt;BR /&gt;
%LET numatt1 = %EVAL(&amp;amp;numatt.-1);&lt;BR /&gt;
%LET numatt2 = %EVAL(&amp;amp;numatt.-2);&lt;BR /&gt;
DATA kernel; SET kernel;&lt;BR /&gt;
&lt;BR /&gt;
* Main effects;&lt;BR /&gt;
		CALL CATX(" ", Main, OF L1_11--L&amp;amp;numitem._1&amp;amp;numatt.);&lt;BR /&gt;
	PUTLOG _ALL_;</description>
      <pubDate>Mon, 07 Mar 2011 02:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/call-catx/m-p/22815#M4998</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-07T02:27:10Z</dc:date>
    </item>
  </channel>
</rss>

