BookmarkSubscribeRSS Feed
sasnewbie5
Fluorite | Level 6

I need to create a new variable that contains the first and last name from my dataset. The code I have is as follows:

data hw9.combo;
	infile "/folders/myfolders/hw9/combo";
	input name = firstname + lastname;
run;

I get the following errors when trying to run it:

NOTE: Variable lastname is uninitialized.
ERROR: Physical file does not exist, /folders/myfolders/hw9/combo.
 
Can anyone help me resolve this? I'm using SAS university edition, which is why I did the file location that way.
3 REPLIES 3
r_behata
Barite | Level 11

Hello @sasnewbie5 . Please look into this video, it may be a good reference point for importing external data into SAS.

 

https://video.sas.com/detail/video/4573016758001/creating-a-sas-table-from-a-csv-file

 

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

 

@sasnewbie5 wrote

data hw9.combo;

infile "/folders/myfolders/hw9/combo";

input name = firstname + lastname;

run;

we don't add character variables.

 

one way to create a new variable name would be

name = firstname || ' ' || lastname;

 

 

 

ballardw
Super User

First thing will be to get the name of the file to read correct.

Second while + is acceptable on an input statement it is used to move a read pointer. The = would not be.

Read the variables then manipulate them.