DATA Step, Macro, Functions and more

Record count in sas dataset

Reply
N/A
Posts: 0

Record count in sas dataset

Hi!


What I want to do is update the Txt column in a Teardata table with the count from a sas dataset.
txt = 'No of apps processed today' || count.
How do I get the count , convert it into varchar so that I can concatenate it with the rest of the text and update the table ?

UPDATE table1
(select count(*) cnt from work.apptable)A;
SET TXT = No of apps processed today' || CAST (A.cnt AS VARCHAR 10),

Thanks!
N/A
Posts: 0

Re: Record count in sas dataset

Posted in reply to deleted_user
Can anyone help please?
Super Contributor
Super Contributor
Posts: 3,174

Re: Record count in sas dataset

Posted in reply to deleted_user
With a SAS assignment you would use the PUT(,best. -l) to tell SAS to convert a numeric variable to a character-formatted string (left-justified operand "-l" if needed).

Scott Barry
SBBWorks, Inc. Message was edited by: sbb
Valued Guide
Posts: 2,177

Re: Record count in sas dataset

Posted in reply to deleted_user
are you running SAS9.2 ?
Have you update privilerger for that table?
With option BDIdirectExec; you might be able to use (beware this is untested code)
select count(*) into :cases separated by ' ' from appTable;
%let string = No of apps processed today= &cases ;
update tdata.table1 set txt= "&string"
where row_ID = &row_ID /* to be updated */
;
Otherwise you are back to using explicit pass-thru.
If you've not already seen it, you might find useful "Teradata Processing Tips for SAS Users" at
http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001399962.htm
N/A
Posts: 0

Re: Record count in sas dataset

Thanks Peter. This worked like a charm!
Ask a Question
Discussion stats
  • 4 replies
  • 274 views
  • 0 likes
  • 3 in conversation