BookmarkSubscribeRSS Feed
vidyapedii
Fluorite | Level 6

Raw data

101~lilly\5000
102&jasmine|3000
103:rose /7000

 

I need a data set without special characters with 3 varialbles named  " id name and sal"

 

I created programm like this, but getting error

data a;

infile 'C:\SASUniversityEdition\myfolders\vidya\test1.txt' dlm='~' '\' '&' '|' ':' '/';
input id name $ sal;
run;

 

Please help me to create the correct programm


Dataset.JPG
2 REPLIES 2
Ksharp
Super User
If you are using UE, the path should like this:


data a;
infile '/folders/myfolders/test1.txt' dlm='~' '\' '&' '|' ':' '/';
input id name $ sal;
run;

art297
Opal | Level 21

You will get errors for at least two reasons: (1) SAS can't find the file and (2) you didn't specify the delimiters properly. Try this instead:

 

data a;
  infile '/folders/myfolders/vidya/test1.txt' dlm='~&|:/\';
  input id name $ sal;
run;

Art, CEO, AnalystFinder.com

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 743 views
  • 1 like
  • 3 in conversation