Missed asking this question here
Very similar question, but put quotes for Horsepower > 250 and NOT put quotes for Horsepower if it does not meet the condition.
data _null_;
file "/path/output/unix/cars.csv"
dsd dlm = ',';
set sashelp.cars;
if _n_ = 1 then put @1
"Make,Model,Type,Origin,DriveTrain,MSRP,Invoice,EngineSize,Cylinders,Horsepower,MPG_City,MPG_Highway,Weight,Wheelbase,Length";
put Make
Model
Type
Origin
DriveTrain
MSRP
Invoice
EngineSize
Cylinders
Horsepower ~
MPG_City
MPG_Highway
Weight
Wheelbase
Length;
run;
458 data _null_; 459 set sashelp.cars(obs=5); 460 file log dsd ; 461 put 462 Make 463 Model 464 MSRP 465 EngineSize 466 Cylinders 467 @ 468 ; 469 if horsepower > 250 then put Horsepower ~ @; 470 else put Horsepower @; 471 put 472 MPG_City 473 ; 474 run; Acura,MDX,"$36,945",3.5,6,"265",17 Acura,RSX Type S 2dr,"$23,820",2,4,200,24 Acura,TSX 4dr,"$26,990",2.4,4,200,22 Acura,TL 4dr,"$33,195",3.2,6,"270",20 Acura,3.5 RL 4dr,"$43,755",3.5,6,225,18 NOTE: There were 5 observations read from the data set SASHELP.CARS.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.