how to remove comma

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

how to remove comma

How to extract salary without Rs and comma in salary as in the raw file. I am not able to find my mistake.

 

this is my code

 

data sasdata.new;
infile "F:\Raw.txt";
input Id @3 Name $3. @17 Incentive : percent3. @10 Salary : comma9.;
Total=salary+salary*incentive;
run;

 

attached the raw data file.


Accepted Solutions
Solution
‎04-24-2017 04:39 AM
Trusted Advisor
Posts: 1,137

Re: how to remove comma

Please try

data new;
infile cards missover;
input Id @3 Name $3. @17 Incentive : percent3. @9 Salary :comma9.;
Total=salary+salary*incentive;
cards;
1 Ram Rs250,100 44%
2 xyz Rs310,000 20%
3 Abc Rs420,000 30%
4 MMN Rs520,000 40%
;

@ holds the input record for the execution of the next INPUT statement within the same iteration of the DATA step. This line-hold specifier is called trailing @.
Thanks,
Jag

View solution in original post


All Replies
Super User
Posts: 19,780

Re: how to remove comma

Doesn't Salary start at 9, not 10? 

Occasional Contributor
Posts: 11

Re: how to remove comma

Hi Reeza,

 

I am new to sas. Can you tell me the function of @ and : in sas programming. I am not exactly able to get it.

 

Thanks

Solution
‎04-24-2017 04:39 AM
Trusted Advisor
Posts: 1,137

Re: how to remove comma

Please try

data new;
infile cards missover;
input Id @3 Name $3. @17 Incentive : percent3. @9 Salary :comma9.;
Total=salary+salary*incentive;
cards;
1 Ram Rs250,100 44%
2 xyz Rs310,000 20%
3 Abc Rs420,000 30%
4 MMN Rs520,000 40%
;

@ holds the input record for the execution of the next INPUT statement within the same iteration of the DATA step. This line-hold specifier is called trailing @.
Thanks,
Jag
Occasional Contributor
Posts: 11

Re: how to remove comma

Posted in reply to Jagadishkatam

thanks for explaining. I Understood how does @ works.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 169 views
  • 4 likes
  • 3 in conversation