Search code examples
copyproc

Using proc datasets copy on files that fit a certain condition


As the title suggests I'd like to copy SAS tables from a Library to another but not all tables. I'd like to copy the tables which names start with 's' for example. I know that I have to use proc datasets copy but which option? How ? (English isn't my first English so Im sorry if my question isnt clear))


Solution

  • It is probably easier to just use PROC COPY. You can use : as a wildcard in the SELECT statement.

    12220  proc copy inlib=work outlib=out;
    12221    select c: / mtype=data ;
    12222  run;
    
    NOTE: Copying WORK.CHECK to OUT.CHECK (memtype=DATA).
    NOTE: There were 3 observations read from the data set WORK.CHECK.
    NOTE: The data set OUT.CHECK has 3 observations and 4 variables.
    NOTE: Copying WORK.CLASS to OUT.CLASS (memtype=DATA).
    NOTE: There were 19 observations read from the data set WORK.CLASS.
    NOTE: The data set OUT.CLASS has 19 observations and 5 variables.