As you can see, at observation 12, the value should be "Dracula:Dead and Loving It (1995)" for the title. However, I got what's shown in the picture above. This is my code:
libname perm '/home/cheok19970/Assignment';
data perm.movies;
informat MovieID 4. Title $60. Genre $50.;
infile '/home/cheok19970/Assignment/movies.dat' dlm=':|';
input MovieID Title $ Genre $;
run;
Since I put colon and vertical pipe as the delimiter, the code is eliminating all the ":" and "|" in the data set. Besides, the output genre only shows one genre. How do i fix it?
The DLMSTR should be :: and then you need to parse GENRE out separately after, because the number of entries there are not consistent, some have 1, some have 3 genres. Make sure to parse out the year as well. For either you can use the SCAN function.
There are some other data issues throughout.
There's actually code on here somewhere on how to read the file properly, someone else asked this already.
DLMSTR in the infile statement. Look it up under the INFILE documentation.
libname perm '/home/cheok19970/Assignment';
data perm.movies;
informat MovieID 4. Title $60. Genre $50.;
infile '/home/cheok19970/Assignment/movies.dat' dlmstr=':|';
input MovieID Title $ Genre $;
run;
proc print data=perm.movies noobs;
run;
I'm getting weird output 😕
The DLMSTR should be :: and then you need to parse GENRE out separately after, because the number of entries there are not consistent, some have 1, some have 3 genres. Make sure to parse out the year as well. For either you can use the SCAN function.
There are some other data issues throughout.
There's actually code on here somewhere on how to read the file properly, someone else asked this already.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: