- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am getting that note for this variable and not for the rest of the variables even if I do a proc content this variable is listed (see attached).
I tried to change the name, the values and I keep on getting that note and cannot do anything with this variable.
Does anybody know why?
Thank you for your help.
Perrine
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What this note is telling you is that you have created a variable called gandbd1, however you have not in the datastep, assigned a value to any row.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That is what I do not understand because there are values. See the attached screenshot.
Thanks,
Perrine
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
And are they assigned in the same datastep as the variable is defined? That is what the note is telling you. For instance, I can get the same note with:
data want; length b $10; run;
I create a variable called b, but in that dataste I assign no values to it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here is my code:
data missingdata;
set surv.HPLanalysis_xlsx;
if recall=3 then meantotveg=MEAN(Totvegd1,Totvegd1);
else if recall=2 then meantotveg=MEAN(Totvegd1);
if recall=3 then meantotGandB=MEAN(GandBd1,GandBd2);
else if recall=2 then meantotGandB=MEAN(GandBd1);
if recall=3 then meantotfruit=MEAN(Totfruitd1,Totfruitd2);
else if recall=2 then meantotfruit=MEAN(Totfruitd1);
run;
It works for the other variables but just not for GandBd1 and GandBd2.
They are all from an excel that has similar variables in it.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that doesn't help me. Please post the dataset: set surv.HPLanalysis_xlsx;, as a datastep (just a few rows is fine) as text here. You can follow this post:
https://communities.sas.com/t5/forums/replypage/board-id/sas_studio/message-id/2483
Also please , post the log of the part where this occurs, does the note follow this specific datastep, if so then the two given variables are not in that dataset and are getting create in this datastep, as as they are used in a condition never get assigned a value e.g to replicate:
data have; Totvegd1=12; output; Totvegd2=1; output; run; /* Note above does not contain gbandbd1 */ data want; set have; result1=mean(totvegd1,totvegd2); result2=mean(gbandbd1,totvegd1); run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here is the code and log:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Ok, so:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do a proc contents on surv.HPLanalysis_xlsx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The screenshot of the proc content is in my first post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Perrine wrote:
The screenshot of the proc content is in my first post.
And WHICH data set did you run that on? Missingdata or surv.HPLanalysis_xlsx? Yes the variables would be present in Missingdata as you just created them by referencing the variable name. The calculated values are missing because they use variables that are not in surv.HPLanalysis_xlsx.
Run Proc contents on surv.HPLanalysis_xlsx and show the complete result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The proc content is with surv.HPLanalysis_xlsx.
The screenshot is the same as previously attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So finally I found it when I did a proc contents with missingdata. There was a space in my column in excel before GandBd1....
Thank you for all your answers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Post the code and log. Without that, we can only make guesses.