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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

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