BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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!
4 REPLIES 4
deleted_user
Not applicable
Can anyone help please?
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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
Peter_C
Rhodochrosite | Level 12
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
deleted_user
Not applicable
Thanks Peter. This worked like a charm!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1537 views
  • 0 likes
  • 3 in conversation