BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anirghy
Calcite | Level 5

I am fairly new to SAS.Can anyone help me to read this data.

EVANS DONNY 112 29,996.63
HELMS LISA 105 18,567.23
HIGGINS JOHN 111 25,309.00
LARSON AMY 113 32,696.78
MOORE MARY 112 28,945.89
POWELL JASON 103 35,099.50
RILEY JUDY 111 25,309.00
RYAN NEAL 112 28,180.00
WILSON HENRY 113 31,875.46
WOODS CHIP 105 17,098.71

 

There should be three variables as 'Name' 'ID' and 'Salary'

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Hello,

I like to use a delimiter, but you can also do without (little code changes are needed then).

You can also use the 'datalines' keyword instead of 'cards'.

data have;
LENGTH NAME $ 12 ID $ 3 Salary 8; 
infile cards delimiter='|';
format Salary comma10.2; 
input Name $ ID $ Salary :comma10.;
Name=strip(Name);
cards;
EVANS DONNY |112|29,996.63
HELMS LISA  |105|18,567.23
HIGGINS JOHN|111|25,309.00
LARSON AMY  |113|32,696.78
MOORE MARY  |112|28,945.89
POWELL JASON|103|35,099.50
RILEY JUDY  |111|25,309.00
RYAN NEAL   |112|28,180.00
WILSON HENRY|113|31,875.46
WOODS CHIP  |105|17,098.71
;
run;
/* end of program */

Cheers,
Koen

View solution in original post

1 REPLY 1
sbxkoenk
SAS Super FREQ

Hello,

I like to use a delimiter, but you can also do without (little code changes are needed then).

You can also use the 'datalines' keyword instead of 'cards'.

data have;
LENGTH NAME $ 12 ID $ 3 Salary 8; 
infile cards delimiter='|';
format Salary comma10.2; 
input Name $ ID $ Salary :comma10.;
Name=strip(Name);
cards;
EVANS DONNY |112|29,996.63
HELMS LISA  |105|18,567.23
HIGGINS JOHN|111|25,309.00
LARSON AMY  |113|32,696.78
MOORE MARY  |112|28,945.89
POWELL JASON|103|35,099.50
RILEY JUDY  |111|25,309.00
RYAN NEAL   |112|28,180.00
WILSON HENRY|113|31,875.46
WOODS CHIP  |105|17,098.71
;
run;
/* end of program */

Cheers,
Koen

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 675 views
  • 0 likes
  • 2 in conversation