DATA Step, Macro, Functions and more

Formatting !

Reply
N/A
Posts: 0

Formatting !

Hi all!
I need to format the input data
Thanks!
SAS Super FREQ
Posts: 8,868

Re: Formatting !

Posted in reply to deleted_user
Hi:
Looks like you also need to add punctuation $$, etc to the number for EVT 1 too?? Is this data and report or data manipulation related to your previous posts showing similar data???

cynthia
N/A
Posts: 0

Re: Formatting !

Posted in reply to Cynthia_sas
Yes I need to add the $ sign for all amounts as well as inset commas and ampersands for names.
This is basically the previous part of teh code which is formatting of the data.
Thsi formatted data will be input to my other transwrd code.

Thanks!
SAS Super FREQ
Posts: 8,868

Re: Formatting !

Posted in reply to deleted_user
Does CUST=100 with EVT=23 have any relationship at all to CUST=123 with EVT=1??? I ask because with BY group processing, all the CUST=100 would sort before CUST=123. I sense that these 4 observations may be related to one "case"...what would happen if you had 2 "cases" How do you know that the EVT=1 belongs to the observations "above" it???

cynthia
N/A
Posts: 0

Re: Formatting !

Posted in reply to Cynthia_sas
They are not related to Cust=123 in this example. But yes there can be a dollar amount as well as the customer name for Cust=100 or for that matter any customer.
Respected Advisor
Posts: 3,799

Re: Formatting !

Posted in reply to deleted_user
This works for PARTY given you data but you need to show more records, and complete specs.

[pre]
ata test;
input (Cust Typ ID Field)($) field_value &$16.;
cards;
100 EVT 23 PARTY JOHN SMITH
100 EVT 23 PARTY EMMA SMITH
100 EVT 23 PARTY BBT COMPANY
123 EVT 1 AggValue 61309
;;;;
run;
proc print;
run;

data test2;
do until(last.field);
set test;
by cust typ id field;
if field eq 'PARTY' then do;
length string $64;
string = catx(cat(substr(', &',1+last.field,1+last.field),' '),string,field_value);
end;
else string = ' ';
end;
run;
proc print;
run;
[/pre]
SAS Super FREQ
Posts: 8,868

Re: Formatting !

Posted in reply to deleted_user
Hi:
There have been a lot of previous postings about the John Smith and the EVT data -- rather than posting pieces of the same problem program over and over, perhaps you could share one entire program log and a sample of your data for folks to work with.

cynthia
These previous posts all seem to be related:
http://support.sas.com/forums/message.jspa?messageID=40884#40884
http://support.sas.com/forums/thread.jspa?messageID=39405駭
http://support.sas.com/forums/thread.jspa?messageID=39561骉
http://support.sas.com/forums/thread.jspa?messageID=39972鰤
http://support.sas.com/forums/thread.jspa?messageID=40211鴓
Ask a Question
Discussion stats
  • 6 replies
  • 183 views
  • 0 likes
  • 3 in conversation