C:\DataMarts\MyAdapter
C:\DataMarts\MyAdapter\stg1357
attrib DATETIME length = 8 format = NLDATM. label = 'Datetime';
attrib DURATION length = 8 format = TIME8. label = 'Duration';
Yes
.
This setting displays all the parameters that are available for the
User-Written Staging transformation. If Enable duplicate
checking is set to No
,
none of these parameters are displayed.
abort
cancel 8;
).
options fmtsearch=(admin.formats sashelp.itms_formats);
options fmtsearch=(admin.formats mylib.formats sashelp.itms_formats);
/* ********************************************************** */ /* Name: UserWrittenStaging */ /* ---------------------------------------------------------- */ /* Description: */ /* Reads the rawdata from the rawdata.txt file that is in */ /* this format: */ /* ddMONyyyy:hh:mm machineName metric1 metric2 */ /* ddMONyyyy:hh:mm machineName metric1 metric2 */ /* <etc.> */ /* ********************************************************** */ libname staging 'c:\UserWritten\Staging'; data staging.metric1 (keep = datetime machine metric1 lstpdate) staging.metric2 (keep = datetime machine metric3 lstpdate); attrib datetime label = "DateTime" format = datetime18.; attrib machine label = "Machine" length = $20; attrib metric1 label = "Metric1" format = NLNUM16.; attrib metric3 label = "Metric2*100" format = NLNUM16.; attrib lstpdate label = "LastProcessDate" format = NLDATM.; attrib metric2 format = NLNUM16.; lstpdate = datetime(); /* needed for aggregation */ infile "c:\UserWritten\rawdata.txt" missover; input datetime datetime15. machine metric1 metric2; metric3 = metric2 * 100; output staging.metric1 staging.metric2; run;
/* ************************************************************** */ /* Name: UserWrittenStaging */ /* -------------------------------------------------------------- */ /* Description: */ /* Reads the rawdata from the rawdata.txt file that is in */ /* this format: */ /* ddMONyyyy:hh:mm machineName metric1 metric2 */ /* ddMONyyyy:hh:mm machineName metric1 metric2 */ /* <etc.> */ /* ************************************************************** */ /* ***PUT CODE INTO A MACRO IN ORDER TO USE %DO STATEMENTS*** */ %macro readRawdata; /* libname staging 'c:\UserWritten\Staging'; */ data /* ***GENERATE TABLE NAMES WITH OPTIONS AND KEEP LISTS*** */ %do i = 1 %to &numTargets; &&target&i (%_ITMS_tableOptions(targetTableNum=&i, generateTableName=NO) keep = %_ITMS_columnList(targetTableNum=&i)) %end; /* ***DUPLICATE CHECKING OUTPUT TABLE*** */ %RMDUPDSN(SOURCE=USR) /* staging.metric1 (keep = datetime machine */ /* metric1 lstpdate) */ /* staging.metric2 (keep = datetime machine */ /* metric2 metric3 lstpdate) */ ; /* ***INITIALIZE DUPLICATE CHECKING*** */ %_ITMS_dupInit; /* ***GENERATE ATTRIB STATEMENTS FOR COLUMNS IN OUTPUT TABLES*** */ %_ITMS_attrib(); /* attrib datetime label = "DateTime" format = datetime18.; */ /* attrib machine label = "Machine" length = $20; */ /* attrib metric1 label = "Metric1" format = NLNUM16.; */ /* attrib metric3 label = "Metric2*100" format = NLNUM16.; */ /* attrib lstpdate label = "LastProcessDate" format = NLDATM.; */ attrib metric2 format = NLNUM16.; lstpdate = datetime(); /* needed for aggregation */ /* infile "c:\UserWritten\rawdata.txt" missover; */ /* ***USE &RAWDATA AND INCLUDE AN END-OF-FILE FLAG FOR*** */ /* ***DUPLICATE CHECKING*** */ infile "&rawdata" end = _eof missover; input datetime datetime15. machine metric1 metric2; /* ***RUN DUPLICATE CHECKING*** */ %_ITMS_dupCheck; /* ***RUN FUTURE DATA CHECKING*** */ %RMSETFTR; /* ***CREATE COMPUTED COLUMNS*** */ %_ITMS_computedColumns; /* metric3 = metric2 * 100; */ /* ***OUTPUT DATA TO TARGET TABLES*** */ output %do i = 1 %to &numTargets &&target&i %end; ; /* output staging.metric1 */ /* staging.metric2; */ run; /* ***UPDATE DUPLICATE CHECKING FILES*** */ %RMDUPUPD; /* ***HANDLE FUTURE DATA*** */ %_ITMS_futureData; %mend readRawdata; %readRawdata;
Domain
Categories
. Within that folder, create one or more
folders for your domain categories. (A domain category is a way of
grouping different types of data such as System, Disk, or Network
data.) Specify a name for these categories that makes sense for your
application.