Hi I have the below sample code with CAR file where i am splitting a column values into two separate columns.
TABLE FILE CAR BY COUNTRY BY MODEL WHERE COUNTRY EQ 'W GERMANY' ON TABLE HOLD AS EXT1 END -*-EXIT DEFINE FILE EXT1 SNO/I2 = IF LAST MODEL NE MODEL THEN SNO+1 ELSE SNO; SNO_IMOD/I2 = IMOD(SNO, 2, SNO_IMOD); END TABLE FILE EXT1 BY COUNTRY BY SNO BY SNO_IMOD BY MODEL ON TABLE HOLD AS EXT2 END -*-EXIT DEFINE FILE EXT2 MODEL_1/A100 = IF SNO_IMOD EQ 1 THEN MODEL ELSE ''; MODEL_2/A100 = IF SNO_IMOD EQ 0 THEN MODEL ELSE ''; END TABLE FILE EXT2 PRINT MODEL_1 MODEL_2 END -EXIT
The output i get is shown below.
I am trying to get the output without the empty string in the rows.I tried COMPUTE and it didn't work for me.
I think i am missing some basic simple logic there,and i am not able to get it right.
Suggestions please.This message has been edited. Last edited by: srajeevan,
Any reason why you're not using SUBSTR or other character functions to split the string?
COMPUTE STR1/A10 = EDIT(MODEL,'999999999$$$$$$$$'); COMPUTE STR2/A10 = EDIT(MODEL,'$$$$$$$$9999999999');
I am not trying to split a particular string.I am string to store values from a column into two separate columns.
Finally got it working.The solution i have is to store the fields into two separate hold files and then join which will give the output the way i need.
Maybe a bit simpler:
TABLE FILE CAR LIST MODEL ON TABLE HOLD END -RUN DEFINE FILE HOLD L/I5=LIST - 1; C/I1=IMOD(L,2,'I1'); R/I5=L / 2; END TABLE FILE HOLD SUM MODEL BY R NOPRINT ACROSS C NOPRINT END
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
|Powered by Social Strata|