📄 m31 - creating and applying user-defined formats - 23 of 25.mht
字号:
for a single value, a range of numeric values, or a list of unique =
values.=20
Unique values must be separated by commas. When <A=20
onmouseover=3D"window.status=3D'Display details on character =
values.';"=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D''"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_9.htm">character=20
values</A> are specified, the values must be enclosed in quotation =
marks,=20
and the format name must begin with a dollar sign ($). You can =
specify=20
non-inclusive <A=20
onmouseover=3D"window.status=3D'Display details on numeric =
ranges.';"=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D''"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_11.htm">numeric=20
ranges</A> by using the "less than" sign (<). The keywords =
HIGH, LOW,=20
and OTHER can be used to label values that are not specifically =
addressed=20
in a range.=20
<P><STRONG>Associating User-Defined Formats with =
Variables</STRONG><BR>To=20
access the permanent, user-defined formats in a <A=20
onmouseover=3D"window.status=3D'Display details on format =
catalogs.'; "=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D''"=20
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_16.htm">format =
catalog</A>, you'll need to use a LIBNAME statement to reference =
the=20
catalog library. To <A=20
onmouseover=3D"window.status=3D'Display details on associating =
formats with variables.'; "=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D''"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_17.htm">associate</A>=
=20
user-defined formats with variables in the FORMAT statement, use =
the same=20
format names in both the FORMAT and VALUE statements, but place a =
period=20
at the end of the format name when it is used in the FORMAT =
statement.=20
</P></TD></TR></TBODY></TABLE><!-- InstanceEndEditable --><BR>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"85%" align=3Dcenter =
border=3D0>
<TBODY>
<TR>
<TD align=3Dleft>
<HR>
</TD></TR></TBODY></TABLE>
<P><!-- InstanceBeginEditable name=3D"syntax" -->
<CENTER>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"85%" border=3D0>
<TBODY>
<TR>
<TD><STRONG><A name=3DSyntax>Syntax</A></STRONG>=20
<P><EM>To go to the page where a statement or option was =
presented, select=20
a link.</EM>=20
<BLOCKQUOTE>
<DL>
<DT><FONT color=3D#003399><STRONG>LIBNAME</STRONG> =
<EM>libref</EM>=20
=
<STRONG>'</STRONG><EM>SAS-data-library</EM><STRONG>';</STRONG></FONT>=20
<DT><FONT color=3D#003399><A=20
onmouseover=3D"window.status=3D'Display details on format =
catalogs.';"=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D''"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_3.htm"><STRONG>PROC=20
FORMAT LIBRARY=3D</STRONG><EM>libref</EM>=20
<STRONG>FMTLIB;</STRONG></A></FONT>=20
<DD><FONT color=3D#003399><A=20
onmouseover=3D"window.status=3D'Display details on defining =
formats.';"=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D'';"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_6.htm"><STRONG>VALUE<=
/STRONG>=20
<EM>format-name</EM></A></FONT>=20
<DD> <FONT color=3D#003399><A=20
onmouseover=3D"window.status=3D'Display details on defining =
formats.';"=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D'';"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_6.htm"><EM>range1=3D'=
label1'</EM></A></FONT>=20
<DD> <FONT color=3D#003399><A=20
onmouseover=3D"window.status=3D'Display details on defining =
formats.';"=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D'';"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_6.htm"><EM>range2=3D'=
label2'</EM></A></FONT>=20
<DD> <FONT color=3D#003399><A=20
onmouseover=3D"window.status=3D'Display details on defining =
formats.'; "=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D'';"=20
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_6.htm">... =
<STRONG>;</STRONG></A></FONT>=20
<DT><FONT color=3D#003399><STRONG>RUN;</STRONG></FONT>=20
<DT><FONT color=3D#003399><STRONG>DATA</STRONG>=20
<EM>SAS-data-set</EM>;</FONT>=20
<DD><FONT color=3D#003399><STRONG>INFILE</STRONG>=20
<EM>data-file</EM>;</FONT>=20
<DD><FONT color=3D#003399><STRONG>INPUT</STRONG> <EM>pointer=20
variable-name informat.</EM>;</FONT>=20
<DD><FONT color=3D#003399><A=20
onmouseover=3D"window.status=3D'Display details on associating =
formats with variables.'; "=20
onclick=3DsuggestBack() onmouseout=3D"window.status=3D''"=20
=
href=3D"http://www.sas.com/apps/OLTRN/59080/m31/m31_16.htm#assign"><STRON=
G>FORMAT</STRONG>=20
<EM>variable(s) format-name</EM><STRONG>.;</STRONG></A></FONT> =
<DT><FONT color=3D#003399><STRONG>RUN;</STRONG></FONT>=20
</DT></DL></BLOCKQUOTE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"85%" border=3D0>
<TBODY>
<TR>
<TD align=3Dleft>
<HR>
</TD></TR></TBODY></TABLE><BR></CENTER><!-- InstanceEndEditable -->
<P><!-- InstanceBeginEditable name=3D"sampleprogram" -->
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"85%" border=3D0>
<TBODY>
<TR>
<TD align=3Dleft><STRONG><A name=3DSample>Sample =
Programs</A></STRONG> <PRE> <FONT color=3D#003399>libname library =
'c:\sas\formats\lib';</FONT>
<FONT color=3D#003399> proc format library=3Dlibrary fmtlib;</FONT>
<FONT color=3D#003399> value jobfmt</FONT>
<FONT color=3D#003399> 103=3D'manager'</FONT>
<FONT color=3D#003399> 105=3D'text processor';</FONT>
<FONT color=3D#003399> run;</FONT>
<FONT color=3D#003399> data perm.empinfo;</FONT>
<FONT color=3D#003399> infile empdata;</FONT>
<FONT color=3D#003399> input @9 FirstName $5. @1 LastName $7. =
</FONT>
<FONT color=3D#003399> +7 JobTitle 3.</FONT> <FONT =
color=3D#003399>@19 Salary comma9.;</FONT>
<FONT color=3D#003399> format salary comma9.2 jobtitle =
jobfmt.;</FONT>
<FONT color=3D#003399> run;</FONT></PRE>
<P>
<HR>
</TD></TR></TBODY></TABLE><BR><!-- InstanceEndEditable -->
<P><!-- InstanceBeginEditable name=3D"pointstoremember" -->
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"85%" border=3D0>
<TBODY>
<TR>
<TD align=3Dleft><STRONG><A name=3DPoints>Points to =
Remember</A></STRONG>=20
<UL>
<LI>Formats--even permanently associated ones--do not affect the =
values=20
of variables in a SAS data set. Only the appearance of the =
values is=20
altered. <BR><BR>
<LI>A user-defined format name must begin with a dollar sign ($) =
when it=20
is assigned to character variables. A format name cannot end =
with a=20
number. <BR><BR>
<LI>Use two single quotation marks when you want an apostrophe =
to appear=20
in a label. <BR><BR>
<LI>Place a period at the end of the format name when you use =
the format=20
name in the FORMAT statement. =
</LI></UL></TD></TR></TBODY></TABLE><!-- InstanceEndEditable =
--></CENTER><!-- #BeginLibraryItem "/Library/nav_regular_bottom.lbi" -->
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%">
<TBODY>
<TR>
<TD width=3D14><IMG height=3D7 alt=3D""=20
=
src=3D"http://www.sas.com/apps/elearning/images/en/navimages/linebox.gif"=
=20
width=3D14></TD>
<TD colSpan=3D2><IMG height=3D7 alt=3D""=20
=
src=3D"http://www.sas.com/apps/elearning/images/en/navimages/linegray.gif=
"=20
width=3D"100%"></TD></TR>
<TR>
<TD> </TD>
<TD vAlign=3Dtop><FONT face=3D"Verdana, Arial, Helvetica, Sans =
Serif"=20
color=3Dgray size=3D1><A class=3Dcopyrightlink=20
href=3D"javascript:%20openOther('../copyrite.htm')"><FONT=20
face=3D"Arial, Helvetica, sans-serif">Copyright</FONT></A> <FONT=20
face=3D"Arial, Helvetica, sans-serif">=A9 2003 SAS Institute Inc., =
Cary, NC,=20
USA. All rights reserved.</FONT></FONT> <FONT=20
face=3D"Arial, Helvetica, sans-serif"><BR><FONT color=3Dgray =
size=3D1><A=20
class=3Dcopyrightlink href=3D"http://www.sas.com/Copyright.html"=20
target=3D_blank>Terms of Use & Legal Information</A> | <A=20
class=3Dcopyrightlink href=3D"http://www.sas.com/Privacy.html"=20
target=3D_blank>Privacy Statement</A></FONT> </FONT></TD>
<TD width=3D60>
<DIV align=3Dright><A=20
onmouseover=3D"rOver('back2');window.status=3D'Display the =
previous page.';return true"=20
accessKey=3Db =
onmouseout=3D"rOut('back2');window.status=3D'';return true"=20
href=3D"javascript:%20prevPage()"><IMG height=3D19 alt=3Dback=20
=
src=3D"http://www.sas.com/apps/elearning/images/en/navimages/back2.gif"=20
width=3D30 border=3D0 name=3Dback2></A><A=20
onmouseover=3D"rOver('next2');window.status=3D'Display the next =
page.';return true"=20
accessKey=3Dn =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -