How can I convert a numeric date variable to a character variable using PROC SQL?

Helpful documents for Proc SQL:Inside PROC SQL's Query Optimizer


PROC SQL -- The Long and The Short of It

Performance Enhancements to PROC SQL in Version 7 of the SAS® System


Using the SAS/ACCESS Libname Technology to Get Improvements in Performance and Optimizations in SAS/SQL Queries

How can I convert a numeric date variable to a character variable using PROC SQL?The PUT function can be used within PROC SQL to create a character date string from a numeric SAS date value. data numdate;


******************************************************;
data numdate;
date=TODAY();
run;

proc sql;create table new as select PUT(date,date9.)
as newdate from numdate;
quit;

************************************************************;source:
www.support.sas.com
How can I convert a character date variable to a numeric date variable with PROC SQL?

The INPUT function can be used within PROC SQL to create a numeric date variable from a character date string.
****************************************************************;
data chardate;
date='08/30/2006';
run;


proc sql;
create table new as select INPUT(date,mmddyy10.)
as newdate format=mmddyy10. from chardate;
quit;


****************************************************************;
source: http://www.support.sas.com/ Usage Note 24527...

Comments

Popular posts from this blog

SAS Interview Questions and Answers: CDISC, SDTM and ADAM etc

Comparing Two Methods for Removing Formats and Informats in SAS: DATA Step vs. PROC DATASETS

Studyday calculation ( --DY Variable in SDTM)