libname fmts "/temp/formats";
proc format library=fmts cntlout=fmts.fmtout;
run;
Showing posts with label Format. Show all posts
Showing posts with label Format. Show all posts
Thursday, January 20, 2011
Friday, December 10, 2010
Thursday, October 28, 2010
Create FORMAT library from a SAS dataset
data fmt(keep=fmtname start label);
      set temp;
      fmtname="TRTFMT";
      start=trtgrp;
      label=trtlbl;
run;
proc format library=work cntlin=fmt;
run;
=================
TEMP:
trtgrp      trtlbl
1            Treatment 1
2            Treatment 2
3            Placebo
      set temp;
      fmtname="TRTFMT";
      start=trtgrp;
      label=trtlbl;
run;
proc format library=work cntlin=fmt;
run;
=================
TEMP:
trtgrp      trtlbl
1            Treatment 1
2            Treatment 2
3            Placebo
Friday, August 27, 2010
Delete single format from library
proc catalog catalog=library.formats;
        delete yn.format dnk.formatc;
quit;
*** yn is numeric format, dnk is character format;
        delete yn.format dnk.formatc;
quit;
*** yn is numeric format, dnk is character format;
Thursday, August 19, 2010
Thursday, February 4, 2010
Wednesday, November 11, 2009
“??” FORMAT MODIFIER
DETERMINE IF A CHARACTER STRING CONTAINS ONLY NUMBERS USING THE INPUT FUNCTION AND THE SPECIAL "??" FORMAT MODIFIER
The following excerpt is from SAS OnlineDoc documentation: ? or ??
The optional question mark (?) and double question mark (??) format modifiers suppress the printing of both the error messages and the input lines when invalid data values are read. The ? modifier suppresses the invalid data message. The ?? modifier also suppresses the invalid data message and, in addition, prevents the automatic variable _ERROR_ from being set to 1 when invalid data are read. Below is an example of using ?? to determine whether a variable contains non-numeric values or not:
data _null_;
x = “12345678”;
if (input(x, ?? 8.) eq .) then
put ‘non-numeric’;
else put ‘numeric’;
run;
Running SAS would return “Numeric” in the above example. If we used X=”123a5678”, SAS would return “Non-Numeric”. Note that the input format in the above example is “8.” So only the first 8 bytes of the character string are checked. Thus, X=123456789a would return “Numeric” as it would only be checking the first 8 bytes of the string.
Link: http://www.nesug.org/Proceedings/nesug01/at/at1013.pdf
The following excerpt is from SAS OnlineDoc documentation: ? or ??
The optional question mark (?) and double question mark (??) format modifiers suppress the printing of both the error messages and the input lines when invalid data values are read. The ? modifier suppresses the invalid data message. The ?? modifier also suppresses the invalid data message and, in addition, prevents the automatic variable _ERROR_ from being set to 1 when invalid data are read. Below is an example of using ?? to determine whether a variable contains non-numeric values or not:
data _null_;
x = “12345678”;
if (input(x, ?? 8.) eq .) then
put ‘non-numeric’;
else put ‘numeric’;
run;
Running SAS would return “Numeric” in the above example. If we used X=”123a5678”, SAS would return “Non-Numeric”. Note that the input format in the above example is “8.” So only the first 8 bytes of the character string are checked. Thus, X=123456789a would return “Numeric” as it would only be checking the first 8 bytes of the string.
Link: http://www.nesug.org/Proceedings/nesug01/at/at1013.pdf
Thursday, September 3, 2009
Remove formats/informats/labels from a SAS dataset
data demo;
set demo;
attrib _all_ label=''; *remove labels;
format _all_; *remove formats;
informat _all_; *remove informats;
run;
set demo;
attrib _all_ label=''; *remove labels;
format _all_; *remove formats;
informat _all_; *remove informats;
run;
Wednesday, July 22, 2009
FMTLIB
Adding the keyword FMTLIB to the PROC FORMAT statement displays a list of all the formats in your catalog, along with descriptions of their values.
libname library 'c:\sas\formats\lib';
proc format library=library fmtlib;
run;
libname library 'c:\sas\formats\lib';
proc format library=library fmtlib;
run;
Subscribe to:
Posts (Atom)