I'm trying to learn SAS by coding. Currently, I'm trying to use an if statement for an imported dataset from an excel sheet. However, I'm facing an issue with the if statement. I think it's because the syntax is wrong. What I have read, is that an if statement can be used in a data step.
What I want to achieve is to delete some observations - If the gender is not female, then it has to delete the observation.
This is how I have tried to do:
proc import datafile="C:\Users\User\Desktop\test.xlsx"
DBMS=XLSX
out=onlyF;
if Gender != 2 then delete;
run;
The variable name is Gender.
The error I get is for "if": Statement is not valid or it is used out of proper order.
Aucun commentaire:
Enregistrer un commentaire