SAS Component Language Dictionary |
Category: | SAS Table |
Syntax | |
Details | |
Examples | |
Example 1: Using the PUTVARC Routine | |
Example 2: Using the PUTVARN Routine | |
See Also |
Syntax |
CALL PUTVARC(table-id,col-num,cval); |
CALL PUTVARN(table-id,col-num,nval); |
is the identifier that was assigned when the table was opened. If table-id is invalid, the program halts.
is the number of the column in the SAS table. This is the number that is adjacent to the column when the CONTENTS procedure lists the columns in the SAS table. You can use the VARNUM function to obtain this value.
Details |
After PUTVARC writes a character value to a table column, use UPDATE to update the row in the SAS table.
If the SCL program uses CALL SET to link columns in the SCL data vector (SDV) with columns in the Table Data Vector (TDV), do not use the PUTVARN and PUTVARC routines for any columns that are linked by SET. UPDATE and APPEND automatically copy the data from the SDV to the TDV before writing a row to a physical file. Therefore, the value that is copied from the SDV will overwrite the value written to the TDV by PUTVARC or PUTVARN, and the value of the corresponding table column will not be updated with the value specified by PUTVARC or PUTVARN.
Examples |
Change an employee's last name from SMITH to UPDIKE in the column NAME in the table referenced by the table identifier PAYID:
vnum=varnum(payid,'name'); rc=locatec(payid,vnum,'SMITH','u'); if (rc>0) then do; call putvarc(payid,vnum,'UPDIKE'); rc=update(payid); end;
Change an item's price from 1.99 to 2.99 in the table referenced by the table identifier PAYID:
vnum=varnum(payid,'price'); rc=locaten(payid,vnum,1.99,'u'); if (rc>0) then do; call putvarn(payid,vnum,2.99); rc=update(payid); end;
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.