Format every column from a SAS data set in a iterative way

  Kiến thức lập trình

I am new to SAS and came into a seemingly easy problem.

Suppose I want to convert every column to to a specific format/length based on its data type. The pseudo code will look like the following:

for col in df.columns:
    if col has dtype = 'Char', print col, and format it as $255.
    if col has dtype = 'Number', print col, and format it as best8.

I already have the SAS data output so the above loop probably needs to be in the data step, but can this be done earlier at the “import” / proc sql step as well?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT