![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
This sample includes a downloadable SAS Enterprise Guide 4.2 custom add-in task that can be used to convert columns from character to numeric, character to date, character to datetime, and numeric to character.
For more information about using SAS Enterprise Guide, see the SAS Enterprise Guide documentation page.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
/* This code creates a very simple one row sample data set to show a few of the */
/* types of conversions the ColumnConverter custom add-in task can do. */
/* Your data could have any number of rows and columns. */
data Sample_Data;
input ddmmyy $ mmddyy $ yyddmm $ yymmdd $;
cards;
251210 122510 102512 101225
;
run;
/* This code was generated by the ColumnConverter customer add-in task to convert */
/* the character column ddmmyy in the Sample_Data data set to a SAS date column formatted */
/* like 12-25-2010 in a new data set called ColumnConverted in the WORK library.*/
data ColumnConverted;
drop compress_date substr_year substr_day substr_month;
format 'My New SAS Date'n mmddyyD10.;
set WORK.SAMPLE_DATA;
compress_date = compress(ddmmyy,' /-\._:,*');
substr_day = substr(compress_date,1,2);
substr_month = substr(compress_date,3,2);
substr_year = substr(compress_date,5,2);
'My New SAS Date'n = input(compress(substr_month||substr_day||substr_year),anydtdte6.);
run;
proc print data=ColumnConverted;
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This display shows the Column Converter task has converted the character value of '251210' to a SAS date formatted as 12-25-2010 in a new data set named ColumnConverted.
To install and use the custom add-in task in SAS Enterprise Guide 4.2, follow these steps:
This display shows sample input data.
This display shows the user interface of the ColumnConverter custom add-in task.
This display shows the user interface of the ColumnConverter custom add-in task with values assigned.
Run the task to generate the results that are shown under the Output tab in this sample.
| Type: | Sample |
| Date Modified: | 2010-03-24 16:47:16 |
| Date Created: | 2010-03-22 13:16:52 |
| Product Family | Product | Host | Product Release | SAS Release | ||
| Starting | Ending | Starting | Ending | |||
| SAS System | SAS Enterprise Guide | Windows Vista | 4.2 | 9.2 TS2M0 | ||
| Microsoft Windows XP Professional | 4.2 | 9.2 TS2M0 | ||||
| Microsoft Windows Server 2003 Standard Edition | 4.2 | 9.2 TS2M0 | ||||
| Microsoft Windows Server 2003 Enterprise Edition | 4.2 | 9.2 TS2M0 | ||||
| Microsoft® Windows® for x64 | 4.2 | 9.2 TS2M0 | ||||
| Microsoft Windows Server 2003 Datacenter Edition | 4.2 | 9.2 TS2M0 | ||||







