Copying Data Set
Copying a data set is a very common SAS programming task. It can be done easily by using the SET statement.
From our previous example, we have created a data set called TEST.
Now, we will copy this data set into a new data set called TEST2:
Example
Data Test2;
Set Test;
Run;
TEST2 will contain exactly the same data as TEST.
? Sign up for a free SASCrunch account now and keep track of your learning progress!
Exercise
From our last exercise, we have created a data set called PROFILE. Create a new data set called NEW_PROFILE from PROFILE using the SET statement.
Need some help?
HINT:
Simply use the SET statement to copy the data set.
SOLUTION:
Data New_Profile;
Set Profile;
Run;
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |