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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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