The DATASETS Procedure |
Restriction: | You cannot change the length of a variable using the LENGTH= option on an ATTRIB statement. |
Featured in: | Modifying SAS Data Sets |
MODIFY SAS-file <(option-1 <...option-n>)>
</ <CORRECTENCODING=encoding-value> <DTC=SAS-date-time> <GENNUM=integer> <MEMTYPE=mtype>>; |
Required Arguments |
specifies a SAS file that exists in the procedure input library.
Options |
assigns, changes, or removes an alter password for the SAS file named in the MODIFY statement. password-modification is one of the following:
new-password
old-password / new-password
/ new-password
old-password /
/
See also: | Manipulating Passwords |
enables you to change the encoding indicator, which is recorded in the file's descriptor information, in order to match the actual encoding of the file's data.
See: | CORRECTENCODING= Option in the MODIFY Statement of the DATASETS Procedure in SAS National Language Support (NLS): Reference Guide |
specifies a date and time to substitute for the date and time stamp placed on a SAS file at the time of creation. You cannot use this option in parentheses after the name of each SAS file; you must specify DTC= after a forward slash:
modify mydata / dtc='03MAR00:12:01:00'dt;
Restriction: | A SAS file's creation date and time cannot be set later than the date and time the file was actually created. |
Restriction: | DTC= cannot be used with encrypted files or sequential files. |
Restriction: | DTC= can be used only when the resulting SAS file uses the V8 or V9 engine. |
Tip: | Use DTC= to alter a SAS file's creation date and time before using the DATECOPY option in the COPY procedure, CPORT procedure, SORT procedure, and the COPY statement in the DATASETS procedure. |
specifies the maximum number of versions. Use this option in parentheses after the name of SAS file.
Default: | 0 |
Range: | 0 to 1,000 |
restricts processing for generation data sets. You can specify GENNUM= either in parentheses after the name of each SAS file or after a forward slash. Valid value is integer, which is a number that references a specific version from a generation group. Specifying a positive number is an absolute reference to a specific generation number that is appended to a data set's name; that is, gennum=2 specifies MYDATA#002. Specifying a negative number is a relative reference to a historical version in relation to the base version, from the youngest to the oldest; that is, gennum=-1 refers to the youngest historical version. Specifying 0, which is the default, refers to the base version.
See also: | "Understanding Generation Data Sets" in SAS Language Reference: Concepts |
assigns, changes, or removes a data set label for the SAS data set named in the MODIFY statement. If a single quotation mark appears in the label, write it as two single quotation marks. LABEL= or LABEL=' ' removes the current label.
Range: | 1 - 256 characters |
Featured in: | Modifying SAS Data Sets |
Tip: | To remove all variable labels in a data set, use the ATTRIB Statement. |
restricts processing to one member type. You cannot specify MEMTYPE= in parentheses after the name of each SAS file; you must specify MEMTYPE= after a forward slash.
Aliases: | MTYPE= and MT= |
Default: | If you do not specify the MEMTYPE= option in the PROC DATASETS statement or in the MODIFY statement, the default is MEMTYPE=DATA. |
assigns, changes, or removes a read, write, or alter password for the SAS file named in the MODIFY statement. password-modification is one of the following:
new-password
old-password / new-password
/ new-password
old-password /
/
See also: | Manipulating Passwords |
assigns, changes, or removes a read password for the SAS file named in the MODIFY statement. password-modification is one of the following:
new-password
old-password / new-password
/ new-password
old-password /
/
See also: | Manipulating Passwords |
Featured in: | Modifying SAS Data Sets |
specifies how the data are currently sorted. SAS stores the sort information with the file but does not verify that the data are sorted the way you indicate. sort-information can be one of the following:
indicates how the data are currently sorted. Values for by-clause are the variables and options you can use in a BY statement in a PROC SORT step. collate-name names the collating sequence used for the sort. By default, the collating sequence is that of your host operating environment.
removes any existing sort indicator.
Restriction: | The data must be sorted in the order that you specify. If the data is not in the specified order, SAS does not sort it for you. |
Tip: | When using the MODIFY SORTEDBY option, you can also use a numbered range list or colon list. For more information, see Data Set Lists. |
Featured in: | Modifying SAS Data Sets |
assigns or changes the special data set type of a SAS data set. SAS does not verify the following:
the SAS data set type you specify in the TYPE= option (except to check if it has a length of eight or fewer characters).
that the SAS data set's structure is appropriate for the type you have designated.
Note: Do not confuse the TYPE= option with the MEMTYPE= option. The TYPE= option specifies a type of special SAS data set. The MEMTYPE= option specifies one or more types of SAS files in a SAS library.
Tip: | Most SAS data sets have no special type. However, certain SAS procedures, like the CORR procedure, can create a number of special SAS data sets. In addition, SAS/STAT software and SAS/EIS software support special data set types. |
assigns, changes, or removes a write password for the SAS file named in the MODIFY statement. password-modification is one of the following:
new-password
old-password / new-password
/ new-password
old-password /
/
See also: | Manipulating Passwords |
Changing Data Set Labels and Variable Labels |
The LABEL option can change either the data set label or a variable label within the data set. To change a data set label, use the following syntax:
modify datasetname(label='Label for Data Set'); run;
You can change one or more variable labels within a data set. To change a variable label within the data set, use the following syntax:
modify datasetname; label variablename='Label for Variable'; run;
For an example of changing both a data set label and a variable label in the same PROC DATASETS, see Modifying SAS Data Sets.
Manipulating Passwords |
In order to assign, change, or remove a password, you must specify the password for the highest level of protection that currently exists on that file.
/* assigns a password to an unprotected file */ modify colors (pw=green);
/* assigns an alter password to an already read-protected SAS data set */ modify colors (read=green alter=red);
/* changes the write password from YELLOW to BROWN */ modify cars (write=yellow/brown);
/* uses alter access to change unknown read password to BLUE */ modify colors (read=/blue alter=red);
/* removes the alter password RED from STATES */ modify states (alter=red/);
/* uses alter access to remove the read password */ modify zoology (read=green/ alter=red);
/* uses PW= as an alias for either WRITE= or ALTER= to remove unknown read password */ modify biology (read=/ pw=red);
Working with Generation Groups |
/* changes the number of generations on data set A to 99 */ modify A (genmax=99);
/* removes the alter password RED from STATES#002 */ modify states (alter=red/) / gennum=2;
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.