BookmarkSubscribeRSS Feed
Koke
Fluorite | Level 6

Hello all,

I'm trying to create a text file, and print it. However, it did not show anything in the output. I use sas univeristy edition.

I really not sure that 

A shared folder named "myfolders" was not found on the virtual machine. See the FAQ for details.

this message that show in the notification effect the problem or not.

Need help

My example data from (infile).txt 

11
Xxxxxxxx Yyyy 
XX 
5-8
YY 
2X

 

Here is my code

data _null_
;
infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt" delimiter="-"
;
Input number $ 2. #2 firstname $ 1-8 lastname $ 11. #3 code $ #4 feet 1. inches #5
level $ #6 jersey $
;
file "/folders/myfolders/soccer.txt" print;
Title;
Put @2 firstname lastname 'wear Number' @1 number ;
Put;
run;

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 data _null_
63 ;
64 infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt" delimiter="-"
65 ;
66 Input number $ 2. #2 firstname $ 1-8 lastname $ 11. #3 code $ #4 feet 1. inches #5
67 level $ #6 jersey $
68 ;
69 file "/folders/myfolders/soccer.txt" print;
70 Title;
71 Put @2 firstname lastname 'wear Number' @1 number ;
72 Put;
73 run;
 
NOTE: The infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt" is:
(no system-specific pathname available),
(no system-specific file attributes available)
 
NOTE: The file "/folders/myfolders/soccer.txt" is:
(no system-specific pathname available),
(no system-specific file attributes available)
 
NOTE: 192 records were read from the infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt".
The minimum record length was 22.
The maximum record length was 22.
NOTE: 32 records were written to the file "/folders/myfolders/soccer.txt".
The minimum record length was 23.
The maximum record length was 30.
NOTE: DATA statement used (Total process time):
real time 0.11 seconds
cpu time 0.02 seconds
 
 
74
75
76
77
78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91
 
Thank.
4 REPLIES 4
Shmuel
Garnet | Level 18

It seems that the output text file was created fine.

 

I don't see any code for printing it. The put statemane writes to the output text file.

Koke
Fluorite | Level 6

Oh, my silly mistake Thx.

Reeza
Super User

You're reading from the same file you're writing back to (soccer.txt). That makes it hard to test and check anything. I would suggest changing the second file to a different name to see if you get what you need. The other big issue with this type of coding is that you've destroyed the original file, so if you did it wrong and replaced the file, which it looks like you did, you'll have to replace your original soccer file to start again.

 


@Koke wrote:

Hello all,

I'm trying to create a text file, and print it. However, it did not show anything in the output. I use sas univeristy edition.

 



Your code is reading a text file and then writing back to that text file some of the variables. I suspect this isn't what you want. 

Do you want to import a text file into SAS and then use PROC PRINT to display your data?

 


@Koke wrote:

Hello all,

I'm trying to create a text file, and print it. However, it did not show anything in the output. I use sas univeristy edition.

I really not sure that 

A shared folder named "myfolders" was not found on the virtual machine. See the FAQ for details.

this message that show in the notification effect the problem or not.

Need help

My example data from (infile).txt 

11
Xxxxxxxx Yyyy 
XX 
5-8
YY 
2X

 

Here is my code

data _null_
;
infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt" delimiter="-"
;
Input number $ 2. #2 firstname $ 1-8 lastname $ 11. #3 code $ #4 feet 1. inches #5
level $ #6 jersey $
;
file "/folders/myfolders/soccer.txt" print;
Title;
Put @2 firstname lastname 'wear Number' @1 number ;
Put;
run;

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 data _null_
63 ;
64 infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt" delimiter="-"
65 ;
66 Input number $ 2. #2 firstname $ 1-8 lastname $ 11. #3 code $ #4 feet 1. inches #5
67 level $ #6 jersey $
68 ;
69 file "/folders/myfolders/soccer.txt" print;
70 Title;
@71 Put @2 firstname lastname 'wear Number' @1 number ;
72 Put;
73 run;
 
NOTE: The infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt" is:
(no system-specific pathname available),
(no system-specific file attributes available)
 
NOTE: The file "/folders/myfolders/soccer.txt" is:
(no system-specific pathname available),
(no system-specific file attributes available)
 
NOTE: 192 records were read from the infile "/folders/myshortcuts/SASUniversityEdition/module 2/soccer.txt".
The minimum record length was 22.
The maximum record length was 22.
NOTE: 32 records were written to the file "/folders/myfolders/soccer.txt".
The minimum record length was 23.
The maximum record length was 30.
NOTE: DATA statement used (Total process time):
real time 0.11 seconds
cpu time 0.02 seconds
 
 
74
75
76
77
78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91
 
Thank.

 

 

Koke
Fluorite | Level 6

Oh, my silly mistake Thx.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1251 views
  • 0 likes
  • 3 in conversation